Reputation: 47
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')); ?>
Upvotes: 0
Views: 1991
Reputation: 8100
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.
Upvotes: 3
Reputation: 9616
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
)
);
Upvotes: 3