LX Adjust Field is an adjustable numeric value that uses familiar UI from games and application (plus / minus buttons). It can be assigned a pool of points and other restrictions.
How to use it:
- Link to the form_helper.js file.
- Add the MYformhelper.php file to your CodeIgniter helpers folder.
Load the form helper class as you would normally using this line:
After that, you can add the adjust field by using the line
echo form_adjust($name, $starting_value, $is_numeric, $point_increment, $value_increment, $min, $max );The only required values are the $name and $starting_value.
If you wish to display a "Point pool" you must add a label with id pointsleft, and if you wish said point pool to be submitted, you may also add a hidden input with id pointsleft in your markup. Example:
- $name => The name and id attributes of the input containing the value
- $starting_value => The value from where the counting starts. You can also set a character as a $starting value, just make sure the next property is set to true.
- $is_numeric => If true, the values will increase and decrease as numbers, else they will adjust as characters. Default value is true.
- $point_increment => This sets how many points will be substracted/added from/to the point pool on each click. Default value is 1.
$value_increment => This input sets the amount of points added/substracted to the field value on each click. Default value is 1.
$min => No matter how much you click the "minus" button, the value will not go below this value. Default value is -1000. Can also be a character.
$max => Same thing... Default value is 1000 and can also be a character.