PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 22, 2022

[FIXED] How to create my own name attribute in CakePHP Form?

 February 22, 2022     cakephp, cakephp-3.0     No comments   

Issue

I am using CakePHP 3. I would like to generate my own style input tag. My code is:

     <?php
echo $this->Form->input(
                   'rpassword', array(
                   'class' => 'form-control placeholder-no-fix',
                   'type' => 'password',
                    'autocomplete' => 'off',
                    'placeholder' => 'Re-type Your New Password'
                   )
              );
        ?>

It generates HTML as follows:

 <input name="data[Reseller][rpassword]" class="form-control placeholder-no-fix " autocomplete="off" placeholder="Re-type Your New Password" type="password" id="ResellerRpassword" >

But I want to set name attribute as 'rpassword' only. My expected HTML is:

 <input name="rpassword" class="form-control placeholder-no-fix " autocomplete="off" placeholder="Re-type Your New Password" type="password" id="ResellerRpassword" >

Is there any way to do this?


Solution

You can set the name attribute in the input parameters like 'name' => 'rpassword':-

echo $this->Form->input(
    'rpassword', array(
        'class' => 'form-control placeholder-no-fix',
        'type' => 'password',
        'name' => 'rpassword',
        'autocomplete' => 'off',
        'placeholder' => 'Re-type Your New Password'
    )
);


Answered By - drmonkeyninja
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing