FormController
Extends:
Performs really basic form validation
Constructor Summary
Public Constructor | ||
public |
constructor(form: HTMLFormElement) Sets up an empty form validation for a form. |
Member Summary
Public Members | ||
public |
|
|
public get |
formData: FormData Returns form data. |
|
public get |
Returns HTTP method |
|
public get |
Returns action target. |
|
public get |
Prepares a AJAX request with form endpoints |
Method Summary
Public Methods | ||
public |
addConstraint(constraint: FormConstraint) Adds a form constraint |
|
public |
addConstraints(constraints: FormConstraint[]) Adds a list of constraints. |
|
public |
Hides error displays |
|
public |
display(errors: ValidationError[]) Displays the errors. |
|
public |
foreignSynchronize(text: string, time: number) Returns a foreign synchronization node |
|
public |
setFieldWithName(value: string, name: string) Creates or sets a form field with a |
|
public |
Submits a form. |
|
public |
validate(): ValidationError[] Validates the form. |
Public Constructors
public constructor(form: HTMLFormElement) source
Sets up an empty form validation for a form. This will run when the form
is submitted, or manually using the .submit()
function. Setup a
delegate too
Params:
Name | Type | Attribute | Description |
form | HTMLFormElement | Form element |
Public Members
public delegate: FormControllerDelegate source
Public Methods
public addConstraint(constraint: FormConstraint) source
Adds a form constraint
Params:
Name | Type | Attribute | Description |
constraint | FormConstraint | A constraint to add to the current form. |
public addConstraints(constraints: FormConstraint[]) source
Adds a list of constraints.
Params:
Name | Type | Attribute | Description |
constraints | FormConstraint[] | A list of form constraints to add |
public display(errors: ValidationError[]) source
Displays the errors.
Params:
Name | Type | Attribute | Description |
errors | ValidationError[] | List of validation errors. |
public setFieldWithName(value: string, name: string) source
Creates or sets a form field with a name
as an identifying key.