inputEx - StringField Usage

Basic StringField creation

Use the following code to create a basic inputEx field.

With a default value

You can set a default value by specifying the 'value' property in the options object.

Changing the size

You can set the size of the input.

Maximum and minimum length

You can add a maximum/minimum length on string fields :

Required

If the 'required' property is set, the 'validate' method will return false if the field is empty. In a form, the 'validate' method will be called on each field and will return false if at least one field doesn't validate.

Regular Expression 1

Here is an example on how to check the value with a regular expression. (It is better to use the IntegerField, but this is a simple example.)

Regular Expression 2

The basic Field class can use regular expressions to validate the field content. Here is an example with this wonderful email regular expression (note that there is an Email Field class).

Enabling/Disabling inputs

You can call the methods 'disable' or 'enable' to set the state of the field.

Updated event

How to listen to the updated event :

Type invitation

Display a text when the field is empty.

Various options

Config with various options : typeInvite, required, minLength, trim  --  Test setValue and getValue methods

Focus the field

Use the focus method