Class: FormComponent

FormComponent(dataObjectopt, optionsopt)

FormComponent is meant to be used to modify values of a DataModel. FormComponent holds: - a heading that titles the form - a set of FormFieldComponents that provide input UI for fields in the DataModel

Constructor

new FormComponent(dataObjectopt, optionsopt)

Parameters:
Name Type Attributes Default Description
dataObject DataObject <optional>
null
options Object <optional>
see the {@Component} for inherited options
Properties
Name Type Attributes Default Description
heading string <optional>
null the heading text for this form
Source:
To Do:
  • Create a PasswordInputFieldComponent
  • Create a form error display element and per-field error display elements
  • Add a `WaitComponent` to show while submitting the form
  • Add default Submit/Reset/Clear controls
Example
class SignInComponent extends FormComponent {
	constructor(dataObject=null, options={}) {
		super(dataObject, Object.assign({
			heading: 'Sign-in:'
		}, options))
		this.addClass('sign-in-component')

		this._usernameComponent = new TextInputFieldComponent(
			this.dataObject,
			{ label: lt('username'), placeholder: lt('Enter your account username') }
		).appendTo(this.fieldsComponent)

		this._passwordComponent = new PasswordInputFieldComponent(
			this.dataObject,
			{ label: lt('password'), placeholder: lt('Enter your account password') }
		).appendTo(this.fieldsComponent)
	}
}

Members

fieldsComponent :Component

a Component in which you should place your fields' Components
Type:
Source: