user710502
user710502

Reputation: 11469

How to avoid labels of inputs

I have this code in cake php but it generates a bunch of labels along with the input that I do not like. How can I get rid of them? I just want the input.

echo $this->Form->hidden('user_role', array('value'=> '2'));
echo $this->Form->input('user_username');
echo $this->Form->input('user_password', array('type' => 'password'));
echo $this->Form->input('user_fname');
echo $this->Form->input('user_lname');
echo $this->Form->input('user_email');
echo $this->Form->input('user_phone');
echo $this->Form->input('user_cellphone');
echo $this->Form->input('user_address1');
echo $this->Form->input('user_address2');
echo $this->Form->input('user_city');
echo $this->Form->input('user_zip');
echo $this->Form->end('Submit');

Thank you

Upvotes: 5

Views: 9057

Answers (1)

felipecrp
felipecrp

Reputation: 1079

Labels are good for usability. But you can remove them in each form field adding the following:

$this->Form->input('user_username', array( 'label' => false ));

You can also disable labels by default when creating the form:

$this->Form->create('User', array('inputDefaults' => array('label' => false)));

Futher information available at their site:

Upvotes: 19

Related Questions