FormValidator class checks all form elements that they are filled correctly according to corresponding rules before submission to the server.
Description | ||
new FormValidator(params?srcNodeRef?) |
Create a new FormValidator widget. |
Description | ||
ENCTYPE_FORM |
"application/x-www-form-urlencoded" used with form. |
|
ENCTYPE_UPLOAD |
"multipart/form-data" used with upload. |
Type | Description | |
_styleAttr | Object |
when you want to set style for other node. you can do this by example...
_styleAttr:{
|
action | String |
Specifies where to send the form data when a form is submitted. |
active | Boolean |
If true, this forces the control to enter the active state and classname 'amos-form-active' will be added. |
afterSubmit | Function |
Specifies the function that want to do after submit. |
autoFocusOnError | Boolean |
If true, element that error has focus automatically. |
beforeSubmit | Function |
Specifies the function that want to do before submit. |
busy | Boolean |
If true, this forces the control to enter the busy state and classname 'amos-form-busy' will be added. |
controls | Object[] |
List of control in a form. |
dataStore | DataStore | Object[] | String |
A data store is a repository of a set of data objects. |
disabled | Boolean |
If true, any control's events(except change) are not responding. Its content cannot be edited and is excluded when the form is submitted. |
enctype | String |
Encoding type for the form (use constant). |
error | Boolean |
If true, this forces the control to enter the error state and classname 'amos-form-error' will be added. |
errorMessageVisible | Boolean |
Can Specifies the error message to hide or show. |
filled | Boolean |
A flag that shows whether a form element is filled in (true) or empty (false). |
invalidMessage | String |
Text of invalidMessage. |
label | String |
Label of an element. |
messageNode | Node |
The element that used to display error message. |
method | String |
HTTP method used to submit the form, either "GET" or "POST". |
name | String |
Name of form for scripting. |
readOnly | Boolean |
If true, the control is read-only and cannot be edited. However, its content, if presents, is included in form submission. |
target | String |
Target frame for the document to be opened in. |
valid | Boolean |
Validity flag that shows whether a form element is validated to be valid (true) or invalid (false). |
value | Object |
Value of FormValidator. |
viewMode | Boolean |
If true the control will be show only displayedValue. |
Return type | Description | |
__baseClassInherit(constructor) | None |
get className from superclass. |
hide(elem?) | None |
Hide a specified element. The hidden element will not be displayed at all. |
isEdit() | Boolean |
Return true if the form that have an edit. |
isValid() | Boolean |
Returns true when text validation succeeded; otherwise, false. |
isVisible(elem?) | Boolean |
Return true if the element is visible, otherwise false. |
reset() | None |
Reset all state and value to default. |
show(elem?) | None |
Display a specified element. |
showValidMessage(valid) | None |
Show error message if valid is true. |
submit(callback?errback?options?) | Dojo/Deferred |
Submit the form. After form submission is done, callback function or errback function are called depending whether form submission is successful or failure. |
toggle(elem?) | None |
Toggle visibility of a specified element. |
Description | ||
enter |
Fires when the enter key is pressed. |
|
submit |
Fires when submit start. |
|
submit-completed |
Fires when submit complete. |
|
submit-error |
Fires when submit error. |
when you want to set style for other node. you can do this by example...
_styleAttr:{
style-property
:effected-node
}
this property was effected where this class was inherited and your widget was called by...
var widget = new YourWidget({
style:{
style-property
:style-value
}
});
now effected-node
in you widget will have style-property
= style-value
Default value: {}
If true, this forces the control to enter the active state and classname 'amos-form-active' will be added.
Default value: false
Specifies the function that want to do after submit.
<!-- declarative -->
<form data-dojo-type="esrith/amos/form/FormValidator" data-dojo-props="afterSubmit: ${_formAfterSubmit}">
</form>
// programetic
this.frmValidator = new FormValidator({
afterSubmit: lang.hitch(this, "_formAfterSubmit")
}).placeAt(this.domNode);
this.frmValidator.submit();
_formAfterSubmit: function (objResponse) {
//to receive response after FormValidator send value to server.
}
If true, element that error has focus automatically.
Default value: false
Specifies the function that want to do before submit.
<!-- declarative -->
<form data-dojo-type="esrith/amos/form/FormValidator" data-dojo-props="beforeSubmit: ${_formBeforeSubmit}">
</form>
// programetic
this.frmValidator = new FormValidator({
beforeSubmit: lang.hitch(this, "_formBeforeSubmit")
}).placeAt(this.domNode);
this.frmValidator.submit();
// when call "submit()"
_formBeforeSubmit: function (objValue) {
//to modify value or do something before FormValidator send value to server.
//and return new value.
return objValue;
}
If true, this forces the control to enter the busy state and classname 'amos-form-busy' will be added.
Default value: false
If true, any control's events(except change) are not responding. Its content cannot be edited and is excluded when the form is submitted.
Default value: false
If true, this forces the control to enter the error state and classname 'amos-form-error' will be added.
Default value: false
A flag that shows whether a form element is filled in (true) or empty (false).
Default value: false
If true, the control is read-only and cannot be edited. However, its content, if presents, is included in form submission.
Default value: false
Validity flag that shows whether a form element is validated to be valid (true) or invalid (false).
Default value: true
get className from superclass.
<Object>
constructor
|
Required |
|
Hide a specified element. The hidden element will not be displayed at all.
<Node>
elem
|
Optional |
Specified element to be hidden. |
Return true if the element is visible, otherwise false.
<Node>
elem
|
Optional |
Specified element to be checked. If not specified, domNode of the widget is used instead. |
Reset all state and value to default.
Display a specified element.
<Node>
elem
|
Optional |
Specified element to be displayed. |
Submit the form. After form submission is done, callback function or errback function are called depending whether form submission is successful or failure.
Toggle visibility of a specified element.
<Node>
elem
|
Optional |
Specified element to toggle visibility. |