disable()

Since: Editor 1.0

Disable one or more fields, disallowing user input.
Please note - this property requires the Editor extension for DataTables.

Description

It can at times be useful to disable a particular field, or set of fields, preventing the user from modifying the field's current value. This method provides exactly that ability.

While the field is disabled, it can still have its value set by set() or val().

This is the inverse of the enable() method which will enable a previously disabled field.

Note that the field().disable() method introduced in Editor 1.3 provides the same functionality as this method. Both forms will continue to be supported in future versions of Editor, and they can often be used interchangeably. The key difference is in the return value - this method will return a DataTable.Editor instance, while the field().disable() method returns a DataTable.Editor.Field instance. This can effect how you chain methods if you are using the returned value for chaining.

Type

disable( [ fieldName ] )

Disable one or more fields, preventing the end user from altering the field's value.

Parameters:

Returns:

DataTable.Editor: Editor instance

Examples

Show a 'create' record form, but with a field disabled:

editor
	.disable('account_type')
	.buttons('Save')
	.title('Save')
	.create();

Disable multiple fields by using an array of field names:

editor.disable(['account_type', 'access_level']);

Disable all fields in the form:

editor.disable();