Class: Form

Form

Templates, serializes, and submits forms

Constructor

new Form(optionsopt)

Constructor
Parameters:
Name Type Attributes Description
options object <optional>
Properties
Name Type Attributes Default Description
feedback boolean <optional>
true whether to show feedback during submissions
submitUrl string <optional>
the submitUrl or path to submit the form to
submitRequest function <optional>
null if set, ignores submitUrl and uses this function to submit data
serializeMode number <optional>
0 the mode in which to serialize data
checkboxMode number <optional>
0 the mode in which to serialize checkboxes
formGroupManager number <optional>
FormGroupManager -
excluded Array.<string> <optional>
[':disabled'] exluded fields via css pseudo selectors
validator object <optional>
validator setttings
Properties
Name Type Attributes Description
api string <optional>
the validator api to use
options object <optional>
the validator options
struct object <optional>
the template struct to build the form from, if using a template
Properties
Name Type Attributes Default Description
$wrapper string <optional>
'form' the form element
$header string <optional>
'.form-header' the header selector
$body string <optional>
'.form-body' the body selector
$footer string <optional>
'.form-footer' the footer selector
$cancel string <optional>
'.form-cancel' the cancel button selector
$reset string <optional>
'.form-reset' the reset button selector
$submit string <optional>
'button[type="submit"]' the submit button selector
Source:

Extends

  • Template

Methods

appendSerializedData() → {Form}

Append serialized data
Parameters:
Type Description
Source:
Returns:
Type
Form

build(data) → {Form}

Build inputs from cols
Parameters:
Name Type Description
data object | Array.<object> data for a form input
Source:
Returns:
Type
Form

clean() → {Form}

Remove all data from the form and reset it
Source:
Returns:
Type
Form

initialize() → {Form}

Initialize as a clean form with default values from the DOM
Source:
Returns:
Type
Form

lockSubmit(ms)

Lock the submit button for some amount of ms
Parameters:
Name Type Description
ms number time to lock in milliseconds
Source:

populateForm(data) → {Form}

Populate form fields
Parameters:
Name Type Description
data object collection of properties whos key match an input or select name, and whos value is appropriate for that field
Source:
Returns:
Type
Form

resetForm() → {Form}

Reset the form, using populated data or setting to default values
Source:
Returns:
Type
Form

serializeForm() → {Form}

Public function to serialize the form, as jQuery uses serialize already
Source:
Returns:
Type
Form

slideToggleForm(state) → {Form}

Slide toggle the form body
Parameters:
Name Type Description
state boolean
Source:
Returns:
Type
Form

toggleButtons(state) → {Form}

Toggle the button states
Parameters:
Name Type Description
state boolean
Source:
Returns:
Type
Form

toggleForm(state) → {Form}

Toggle the form body
Parameters:
Name Type Description
state boolean
Source:
Returns:
Type
Form

validate() → {boolean}

Validate the form
Source:
Returns:
Type
boolean