field().fieldInfo()
Get / set description information for the field.
Please note - this property requires the Editor extension for DataTables.
Description
This method provides the ability to get and set an information string that would typically be used to describe a field, in terms of what data the end user is expected to enter (a particular format for example) or or what the data is used for. Although this method makes it possible to dynamically update the string shown, it is recommended that field().message() be used for dynamic content (allowing both the static information text and dynamic messaging to be shown at the same time).
A field description can be set when it is initially added to the form using the fields.fieldInfo option. This API method extends that ability by providing a method to get and set the field information message any point after a field has been added to the form.
Editor provides three different elements for information display in each field, which can be used independently of each other, or in conjunction as required by your user interface design:
fields.message/field().message(): Dynamic information about a field that is typically updated based on user input. This is shown below the field's user input area.fields.fieldInfo/field().fieldInfo(): Very similar to the message option, but typically used for static information about an input - e.g. explaining what format is expected, or what the input value is used for.fields.labelInfo/field().labelInfo(): Information message shown below the field'slabelelement.
Types
field(…).fieldInfo()
field(…).fieldInfo( info )
Set the information text for the field
Parameters:
| Name | Type | Optional | |
|---|---|---|---|
| 1 | info | No | |
Information text to show in the form for the field. To remove an existing message, pass in an empty string ( Additionally, a function can be given as the message, which will be executed by Editor with the returned value being used as the message to display. The function is passed two parameters:
| |||
Returns:
DataTable.Editor.Field: Field instance
Examples
Show a description string explaining what a field does.:
editor
.field('user')
.fieldInfo(
'Your user name should be at least six characters long and can contain any set of characters.'
);Clear an information message:
editor.field('user').fieldInfo('');Related
The following options are directly related and may also be useful in your application development.