0
votes

I am using Cakephp 2.2.3 version. When I create form using Cake form helpers, it automatically appends a div and label to the input type field. How to avoid it?

Following is the code:

 <?php echo $this->Form->input('username', array('id' => 'username', 'class' => 'login-inp', 'type' => 'text')); ?>
2

2 Answers

3
votes

You can use options array of input to avoid form appending div and label automatically. Set div and label of options array to false.

echo $this->Form->input('username',
         array('id' => 'username', 'class' => 'login-inp',
               'div' => false, 'label' => false
         )
     );
3
votes

That's what FormHelper::input() is supposed to do. If you don't want the label and wrapping div just use the functions to generate specific input elements only like FormHelper::text(), FormHelper::select(), FormHelper::radio(), etc.