简体   繁体   中英

how to modify parameters like (style , class ..) in cakephp input?

in cakephp

echo $this->Form->input('email', array('type' => 'email'));

will render

<div class="input email">
<label for="UserEmail">Email</label>
<input type="email" name="data[User][email]" value="" id="UserEmail" />

how to make this like that

    <input type="email" name="data[User][email]" value="" id="UserEmail" class="input_class" style="some:style;" />

Just add a "class" and/or "style" argument to your options array.

echo $this->Form->input('email', array('type' => 'email', 'class' => 'input_class', 'style' => 'some:style' ));

See the the FormHelper documentation for a list of all options.

如果您只需要输入而没有标签,您也可以这样尝试

echo $this->Form->input('email', array('type' => 'email','div'=>false, 'class' => 'input_class', 'style' => 'some:style' ));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM