new Form(domEl, options, view, connector, errorCallback)
Parameters:
Name | Type | Description |
---|---|---|
domEl |
Object | Field container. |
options |
Object | Field options. |
view |
Object | String | Field view. |
connector |
Alpaca.Connector | Field connector. |
errorCallback |
function | Error callback. |
Methods
-
ajaxSubmit()
-
Fires the submit in the background and hands back the jQuery promise.
An optional config can be passed in to control the underlying jQuery ajax XHR.
Returns:
- Type
- *
-
clear(stopUpdateTrigger)
-
Clears the form and resets values of its fields.
Parameters:
Name Type Description stopUpdateTrigger
If false, triggers the update event of this event.
-
destroy(Boolean)
-
Purge any event listeners and remove the form from the DOM.
Parameters:
Name Type Argument Description Boolean
<optional>
skipParent when true, the form cleans up without traversing through parent child controls
-
disable()
-
Disables this form.
-
enable()
-
Enables this form.
-
fireCallback(id, arg1, arg2, arg3, arg4, arg5)
-
Fires a view callback for the current form.
Parameters:
Name Type Description id
arg1
arg2
arg3
arg4
arg5
-
focus()
-
Focuses on this form.
If a callback is provided, the callback receives the focused control.
-
getFormEl()
-
Retrieves the form element.
Returns:
The rendered DOM element.
- Type
- Object
-
getId()
-
Returns the id of the form.
Returns:
Form id
- Type
- String
-
getParent()
-
Returns this form's parent.
Returns:
Form parent.
- Type
- Object
-
getType()
-
Returns form type.
Returns:
Form type.
- Type
- String
-
getValue()
-
Returns the value of the JSON rendered by this form.
Returns:
Value of the JSON rendered by this form.
- Type
- Any
-
hide()
-
Hides the form.
-
initEvents()
-
Initializes events handling (Form Submission) for this form.
-
isEmpty()
-
Checks if form is empty.
Returns:
True if the form is empty, false otherwise.
- Type
- Boolean
-
isFormValid()
-
Determines whether the top control is entirely valid.
Returns:
- Type
- *
-
onSubmit(e, form)
-
Handles form submit events.
Parameters:
Name Type Description e
Object Submit event.
form
Object the form
-
processRender(parentEl, callback)
-
Responsible for fetching any templates needed so as to render the
current mode for this field.Once completed, the onSuccess method is called.
Parameters:
Name Type Description parentEl
Object Field container.
callback
function -
refreshValidationState(children)
-
Displays validation information of all fields of this form.
Parameters:
Name Type Description children
Boolean whether to render validation state for child fields
Returns:
Form validation state.
- Type
- Object
-
registerSubmitHandler(func)
-
Registers a custom submit handler.
Parameters:
Name Type Description func
Object Submit handler to be registered.
-
render(callback)
-
Renders this form into the container.
Parameters:
Name Type Description callback
function -
setValue(value)
-
Sets the value of the JSON to be rendered by this form.
Parameters:
Name Type Description value
Any Value to be set.
-
show()
-
Shows the form.
-
submit()
-
Performs a regular old submit.