Form helpers for creating radio buttons, drop downs, and checkboxes
It contains classes for each field type as show below
Checkbox builder for HTML pages can be used with various templating
use \LSS\Form\Checkbox;
$arr = array(1=>'Yes',2=>'Yes, Please',3=>'Alright!');
//pring checkbox form
echo Checkbox::_get()->setOptions($arr)->setName('test')->setValue(1);
To get the HTML from this class simply transform it to a string.
Examples
echo $form_obj;
$checkboxes = (string)$form_obj;
Shortcut for constructor
Sets the options to this array
Adds an option
Set name of the checkbox elements
Set the current value to be checked (can be an array for multiple checkboxes)
Adds a set value to the array
Call this to turn on line breaks after each checkbox
Adds a CSS class to each element
Add extra parameters to the HTML element containing the object
Dropdown select builder for HTML pages can be used with various templating
use \LSS\Form\Drop;
$arr = array(1=>'Yes',2=>'Yes, Please',3=>'Alright!');
//pring radio form
echo Drop::_get()->setOptions($arr)->setName('test')->setValue(1);
To get the HTML from this class simply transform it to a string.
Examples
echo $form_obj;
$drop = (string)$form_obj;
Shortcut for constructor
Sets the options to this array
Adds an option
Set name of the checkbox elements
Set the current value to be checked
Adds a CSS class to each element
Add extra parameters to the HTML element containing the object
Radio button builder for HTML pages can be used with various templating
use \LSS\Form\Radio;
$arr = array(1=>'Yes',2=>'Yes, Please',3=>'Alright!');
//pring radio form
echo Radio::_get()->setOptions($arr)->setName('test')->setValue(1);
To get the HTML from this class simply transform it to a string.
Examples
echo $form_obj;
$radio = (string)$form_obj;
Shortcut for constructor
Sets the options to this array
Adds an option
Set name of the checkbox elements
Set the current value to be checked
Adds a CSS class to each element
Add extra parameters to the HTML element containing the object
Language | php |
Version | 0.0.0 |
Git URL | https://github.com/nullivex/lib-form |
License | GPL-3.0 |
Description | Form helpers for creating radio buttons, drop downs, and checkboxes |
Keywords |