{hero}

fields.def

Since: Editor 1.3

Default value for the field to take.
Please note - this property requires the Editor extension for DataTables.

The full Editor reference documentation is available to registered users of Editor - the information shown below is a summary only. If you already have an Editor license please , alternatively an Editor license can be purchased on this site, or sign up for the free trial.

Description

The default value of a field is used by the create() command for each field in the form, and when editing a field (edit(), bubble() and inline() if the field's value at the time of editing is undefined). The form fields are automatically filled in with the default values in these circumstances.

Default values can be given as any Javascript data type (numbers, strings, objects, etc), including functions. If given in this form, the function will be evaluated when the default value is requested, and the value returned used. This can be useful, for example, to set the current date as the default in a date input field, since the function is evaluated when requested.

The default value for a field can be retrieved and set using the field().def() API method after the field has been initialised.

Backwards compatibility note

In previous versions of Editor (1.2-) this was called default. It has been renamed since default is a reserved word in Javascript, and although it could be used quoted, that style isn't always desirable. The old name can still be used for backwards compatibility, but the new form is preferred.