我正在使用CakePHP 3.我想生成自己的样式输入标记。我的代码是:
<?php
echo $this->Form->input(
'rpassword', array(
'class' => 'form-control placeholder-no-fix',
'type' => 'password',
'autocomplete' => 'off',
'placeholder' => 'Re-type Your New Password'
)
);
?>
它生成HTML如下:
<input name="data[Reseller][rpassword]" class="form-control placeholder-no-fix " autocomplete="off" placeholder="Re-type Your New Password" type="password" id="ResellerRpassword" >
但我想将name属性设置为'rpassword'。我期望的HTML是:
<input name="rpassword" class="form-control placeholder-no-fix " autocomplete="off" placeholder="Re-type Your New Password" type="password" id="ResellerRpassword" >
有没有办法做到这一点?
答案 0 :(得分:1)
您可以在name
参数中设置input
属性,例如'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'
)
);