Class Index | Minimal

Classes


Class jabberwerx.XDataForm


Extends JWModel.

Holds data form fields and properties.

Class Summary
Constructor Attributes Constructor Name and Description
 
jabberwerx.XDataForm(form, payload)

Creates a new XDataForm with the given DOM element or empty form of the given type.

Field Summary
Field Attributes Field Name and Description
 
Array of XDataFormFields objects for the forms of type "form" and "submit"
 
Array of XDataFormFields objects for the forms of type "result"
 
Array of XDataFormFields objects for the forms of type "result"
Method Summary
Method Attributes Method Name and Description
 
addField(field)

Adds field to the data form.

 

Returns XDataForm type "cancel".

 

Destroys this data form.

 

Returns XDataForm DOM element.

 

Returns field based on var name or null if not found or name is null.

 

Returns first value for the field based on var name or null if field is not found or no values exist for the field.

 

Returns field based on var name or null if not found or name is null.

 

Returns form instructions.

 

Returns form title.

 

Returns form type.

 
setFieldValue(name, value, type)

Sets/clears value for the field based on var name.

 

Sets form type field value for the form.

 
setInstructions(instructions)

Sets form instructions.

 
setTitle(title)

Sets form title.

 
submit(fieldsAndValues)

Creates new jabberwerx.XDataForm and sets values for the passed var(s).

 

Iterates through all the form fields and performs the validation.

Class Detail
jabberwerx.XDataForm(form, payload)

Creates a new XDataForm with the given DOM element or empty form of the given type.

Parameters:
{String} form Optional
The form type
{Element} payload Optional
The DOM representing XDataForm
Throws:
{TypeError}
If any of the parameters are not valid
Field Detail
fields
Array of XDataFormFields objects for the forms of type "form" and "submit"

items
Array of XDataFormFields objects for the forms of type "result"

reported
Array of XDataFormFields objects for the forms of type "result"
Method Detail
addField(field)

Adds field to the data form.

Parameters:
{jabberwerx.XDataFormField} field Optional
Field to add to the form

{jabberwerx.XDataForm} cancel()

Returns XDataForm type "cancel".

Returns:
{jabberwerx.XDataForm} Newly created form of type "cancel".

destroy()

Destroys this data form.


{Element} getDOM()

Returns XDataForm DOM element.

Returns:
{Element} DOM element representing XDataForm

{jabberwerx.XDataFormField} getFieldByVar(name)

Returns field based on var name or null if not found or name is null.

Parameters:
{String} name Optional
Var value for the field
Returns:
{jabberwerx.XDataFormField}

{String} getFieldValue(name)

Returns first value for the field based on var name or null if field is not found or no values exist for the field.

Parameters:
{String} name Optional
Var value for the field
Returns:
{String} First value for the field

{String} getFORM_TYPE()

Returns field based on var name or null if not found or name is null.

Returns:
{String} 'FORM_TYPE' value for the form

{String} getInstructions()

Returns form instructions.

Returns:
{String} Form instructions

{String} getTitle()

Returns form title.

Returns:
{String} Form title

{String} getType()

Returns form type.

Returns:
{String} Form type

setFieldValue(name, value, type)

Sets/clears value for the field based on var name.

This method uses the following algorithm:

  1. If there is no existing field for {name}, a new one is created and inserted into the end of this form, with a type of {type} (or "text-single" if not provided).
  2. If there is an existing field for {name}, and {value} is not null or undefined, its value is updated to {value}, and {type} is ignored.
  3. If there is an existing field for {name}, and {value} is null or undefined, the field is removed.
Parameters:
{String} name Optional
Var name for the field
{String} value Optional
Value for the field
{String} type Optional
Type for the field

setFORM_TYPE(type)

Sets form type field value for the form.

Parameters:
{String} type Optional
'FORM_TYPE' value for the form

setInstructions(instructions)

Sets form instructions.

Parameters:
{String} instructions Optional
Form instructions

setTitle(title)

Sets form title.

Parameters:
{String} title Optional
Form title

{jabberwerx.XDataForm} submit(fieldsAndValues)

Creates new jabberwerx.XDataForm and sets values for the passed var(s).

Parameters:
{Object} fieldsAndValues Optional
Object containing id/value pairs for data fields.
Returns:
{jabberwerx.XDataForm} Newly created form of type "submit".

validate()

Iterates through all the form fields and performs the validation.

Throws:
{TypeError}
If any of the rules for field's values have been violated

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 02 2014 13:23:43 GMT-0600 (MDT)