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])
- description: a string defining the contents of the tooltip | required
- for: defines the tooltips related field. Will be used to create the tooltips class attribute | optional
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)
- attributes: an associative array specifying attributes of the element.
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>