Number, Range, Date, Time

Add Field

// Number field example
$form->addField('Quantity', 'number');

// Range slider example
$form->addField('Feedback', 'range', array('min' => 1,
															        'max'   => 10,
																			'step'  => 2
                                    ));

// Date example
$form->addField('Birthday', 'date');

// Time example
$form->addField('Meeting', 'time', ['label' => 'Choose meeting time',
																	'min' => '08:00',
																	'max' => '10:00'
																		]);

Attributes

You can customize the field with one of these optional parameters:

Parameter Type Default Info
required boolean true Validation will return false when the field is left empty
classlist string has-error will be added to classes if validation returns false.
is-valid will be added if the validation was successful.
Add classes to input field and its field wrap e.g. column-with classes of a grid system.
min int / string Lowest allowed number or earliest possible time/date
max int / string Highest allowed number or latest possible time/date
maxlength int Maximum number of input characters
step int Step between numbers
label string Label for input field
placeholder string Input field placeholder
regex String Validation will match input against this regular expression
readonly string false Read-Only field if it only is available under specific circumstances.
autofocus string false Set cursor autofocus to this field. Only use for a single field per form.