Initializing help system before first use

# AutoForm

Bind elements in an HTML form to model entities in a Scenario. An input form element can be linked with a scalar, parameter or one element of an array. Also provides pre-defined button handlers for common button actions.

### Method summary

name | description
--- | ---
cancelButton | Attach cancel Scenario behaviour to specified button DOM element.
clearBindings | Clear existing form bindings.
loadButton | Attach execute Scenario behaviour to specified button DOM element.
onDataSaved | Attach a callback on data saving completion.
runButton | Attach execute Scenario behaviour to specified button DOM element.
saveButton | Attach save View behaviour to specified button DOM element.

### Constructor

new AutoForm ( scenario )

  Create new AutoForm component.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  scenario | Scenario | The scenario to use when binding entities

### Methods

cancelButton ( id )

  Attach cancel Scenario behaviour to specified button DOM element.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  id | string | The id of the button DOM element

  ##### Example

      var form = new AutoForm(firstScenario);
      form.cancelButton('cancel-btn-id');

  Back to Top
clearBindings ( formId ) → {boolean}

  Clear existing form bindings. This will clear the _formBindings property on the object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  formId | string | The id of the form DOM element.

  Returns:

  Type | Description
  --- | ---
  boolean | Whether the unbind action was successful or not.

  Back to Top
loadButton ( id )

  Attach execute Scenario behaviour to specified button DOM element.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  id | string | The id of the button DOM element

  Back to Top
onDataSaved ( callback )

  Attach a callback that will be called on save of any element associated with this AutoForm instance.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  callback | AutoForm~OnDataSavedCallback | Called when an entity has been successfully updated

  Back to Top
runButton ( id )

  Attach execute Scenario behaviour to specified button DOM element.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  id | string | The id of the button DOM element

  Back to Top
saveButton ( id )

  Attach save View behaviour to specified button DOM element.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  id | string | The id of the button DOM element

  Back to Top

### Type Definitions

AutoFormElementConfig - { Object }
  Data structure for a single AutoForm entity definition.

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  entityName | string | optional | The entity name if this element is an entity.
  parameterName | string | optional | The parameter name if this is a parameter.
  indices | Array.<?> | optional | Array of indices.
  editorValidate | AutoForm~EditorValidationCallback | optional | Callback to validate the element.

EditorValidationCallback ( name, value ) → {Result}

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  name | string | Entity name.
  value | * | Value to validate.

  Returns:

  Type | Description
  --- | ---
  Result | The validation result and message if there is an error.

  Back to Top
OnDataSavedCallback ( scenario, entity, value )

  Callback for AutoForm#onDataSaved.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  scenario | Scenario | The form's scenario
  entity | ModelEntity | The form element's entity. Passes undefined if it is an Insight Parameter type
  value | string | object | Either a single value string or a composite key-value pair, in the case of an array) for the value saved. If removal of an array element then the value will be an empty string

  Back to Top

Parent Topic Classes

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.