GoodForm


Label

Labels can be automatically added to fields by adding a label attribute in the fields attribute array.

There are two ways of adding a label to your form object:

label (string name [, string for])

Example:

$this->goodform->label('Your Name', 'name');

Will produce the following HTML:

<label for="name">Your Name</label>

text (array attributes)

Example:

$attr = array(
	'for' 	=> 'name',
	'value'	=> 'Your Name',
	'class'	=> 'my-label-class',
	'title'	=> 'Enter your full name'
);

$this->goodform->label($attr);

Will produce the following HTML:

<label for="name" class="my-label-class" title="Enter your full name" >Your Name</label>