Constructor
new Form(data, context)
Forms should not be created on their own, they are normally accessed from a containing Resource.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The form data, including field information |
context |
Context | The context of the form. |
Methods
clone() → {Form}
Clone the current Form so that fields can be updated and not impact/change the original form field values.
Returns:
the cloned form.
- Type
- Form
field(name) → {Object}
Lookup the field by the given name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the field to look up. |
Returns:
Object containing the field values.
- Type
- Object
getRequestData() → (nullable) {Object.<string, *>}
Get the name/value data for all the fields of the form.
Returns:
The name/value data for the fields of the form.
- Type
- Object.<string, *>
submit(optionsopt) → {Resource}
Perform an HTTP request to submit the form. The request itself is created based on the URL, method, type, and field values.
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The options for the request. Properties
|
Returns:
A resource that will eventually be resolved with response details.
- Type
- Resource