GoodForm


Tooltip Description

Tooltips can be automatically added to fields by adding a description attribute in the fields attribute array.

Tooltips are used to pass further instructions to the user about a field element.
There are two ways of adding a tooltip to your form object:

tooltip (string description [, string for])

Example:

$this->goodform->tooltip('Date format YYYY/MM/DD', 'dob');

Will produce the following HTML:

<p class="dob-tooltip tooltip">Date format YYYY/MM/DD</p>

tooltip (array attributes)

Example:

$attr = array(
	'for' 	=> 'dob',
	'value'	=> 'Date format YYYY/MM/DD',
	'class'	=> 'my-tooltip-class',
	'title'	=> 'Date format YYYY/MM/DD'
);

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

Will produce the following HTML:

<p class="my-tooltip-class dob-tooltip tooltip" title="Date format YYYY/MM/DD" >Date format YYYY/MM/DD</p>