CustomFields

CustomFields

CustomFields class for handling custom form fields.

Constructor

new CustomFields($form, optionsopt)

Description:
  • Constructor for CustomFields class.

Source:
Parameters:
Name Type Attributes Default Description
$form jQuery | Object

jQuery object or object representing form.

options Object <optional>
{}

Options for customization.

Extends

  • require("www/js/BasicEventHandler.js")

Members

$elm :jQuery

Description:
  • jQuery form element.

Source:

jQuery form element.

Type:
  • jQuery

Methods

addHTML($elm)

Description:
  • Adds HTML content to the form.

Source:
Parameters:
Name Type Description
$elm jQuery

jQuery object representing HTML content.

addJSONForm(settingsopt)

Description:
  • Adds JSON form to the form element.

Source:
Parameters:
Name Type Attributes Default Description
settings Object <optional>
{}

Settings for the JSON form.

getFormValues() → {Object}

Description:
  • Gets JSONForm's value.

Source:
Returns:
  • Form field values.
Type
Object

getJsonFormTree() → {Object}

Description:
  • Gets the JSON form tree.

Source:
Returns:
  • JSON form tree data.
Type
Object

getValues() → {Object}

Description:
  • Gets values from the form.

Source:
Returns:
  • Form field values.
Type
Object

init()

Description:
  • Initialize the CustomFields instance.

Source:

setValueByName(name, val)

Description:
  • Sets value for a field by its name.

Source:
Parameters:
Name Type Description
name string

Name of the field.

val any

Value to set.

setValues(values)

Description:
  • set values from the form.

Source:
Parameters:
Name Type Description
values Object

Form field values.

validate() → {boolean}

Description:
  • Validates the form.

Source:
Returns:
  • Validation result.
Type
boolean

(static) isJsonForm(dataopt) → {boolean}

Description:
  • Checks if the data represents a JSON form.

Source:
Parameters:
Name Type Attributes Default Description
data Object | string | function <optional>
{}

Data to check.

Returns:
  • Whether the data represents a JSON form.
Type
boolean

(static) sanitize(option) → {Object}

Description:
  • Sanitizes options for CustomFields class.

Source:
Parameters:
Name Type Description
option Object

Options object.

Returns:
  • Sanitized options.
Type
Object