Class: Form

Form


new Form(id, fields)

This class is used to validate and submit forms client side. forms are accessible to window by app.formrs[id]
Parameters:
Name Type Description
id string the id of the form
fields Object The list of all fields in the form
Source:

Methods


displayErrorMessage(text)

Display an error message to the form
Parameters:
Name Type Description
text string The message to display
Source:

displayErrors(errors)

Display the errors on the form inputs
Parameters:
Name Type Description
errors Object The errors to display, where keys are inputs names, and values the error messages
Source:

isValid()

Check the dat of the form
Source:
Returns:
- true if the form data is correct, false else
Type
bool

removeErrors()

Remove all the form errors
Source:

reset()

Reset the form values
Source:

setObjectAction(action)

Set the object action of the form. The object action can be "register" or "delete", and represents the action that will be performed server side
Parameters:
Name Type Description
action string The action value to set
Source:

submit()

Submit the form
Source:
Returns:
False
Type
boolean

toString()

Display the content of the form
Source:
Returns:
The JSON representing the form inputs data
Type
string

valueOf()

Get the form data as Object
Source:
Returns:
The object containing the form inputs data
Type
Object