List of default options for inputs
These are general defaults for input elements that can be overridden on a per input basis:
<?php
$input = $form->addText('input', array(
'autocapitalize' => true,
'autocomplete' => true,
'autocorrect' => true,
'autofocus' => true,
'disabled' => false,
'errorMessage' => "There was a problem with your input",
'label' => "Normal Input",
'marker' => "*",
'required' => true,
'class' => "my-class",
'helpMessage' => "addition help message",
'helpMessageHtml' => "addition <b>help message</b>",
);
- Parameters
-
bool $disabled Enables/disables an input variant $dataAttr Optional associated Array of values that will be added as data-Attribute to the container element variant $class Optional CSS class of the container element string $label Sets the label for the input string $labelHtml Sets the unescaped label for the input string $title Sets the title for the input string $lang Sets the lang for the input string $defaultValue Sets the default value for the input string $marker Sets marker character(s) that gets display on required fields. bool $required Sets wether an input is required to hold a value to be valid bool $readonly Marks an input as readonly string | function $validator Sets the validator for the input. - When $validator starts and ends with "/" e.g. "/[a-z0-9]/" the validator will be a Depage::HtmlForm::Validators::RegEx
- When it is a plain string it will be a the validator with the name $validator out of the namespace Depage::HtmlForm::Validators.
- If the $validator is callable then the validator will be a Depage::HtmlForm::Validators::Closure
string $class Class name or class names that gets added to wrapper paragraph. bool $autofocus sets current input to get autofocus on a page. If you set the autofocus to more than one input - The first one gets the focus. bool $autocapitalize Enables/disables autocapitalizion (mostly on mobile devices) bool $autocorrect Enables/disables autocorrection bool $autocomplete Used to enable/disable autocorrect string $errorMessage Sets the message that will be displayed in case of invalid input string $helpMessage Optional help message that may be used for extra information e.g. tooltips. These string will be html escaped. string $helpMessageHtml Optional help message that may be used for extra information e.g. tooltips. These string won't be escaped as therefor has to be valid html. variant $dataPath Optional info for the data saved in the element. This value isn't used internally in the htmlform, but can be used to add extra data to an element that can be read out at a later time. E.g. you can add an object- or an xml-xpath to the element.