Provides central handling of all client side form related logic.
tapestry.form | Provides central handling of all client side form related logic. |
Properties | |
forms | Contains a reference to all registered Tapestry forms in the current document. |
currentFocus | Reference to form element/element id of field that should currently recieve focus, if any |
Functions | |
focusField | If possible, brings keyboard input focus to the specified field. |
registerForm | Registers the form with the local forms property so that there is a central reference of all tapestry forms. |
registerProfile | Registers a form validation/translation profile. |
clearProfiles | Clears any previously registered validation profiles on the specified form. |
setFormValidating | If a form registered with the specified formId exists a local property will be set that causes validation to be turned on/off depending on the argument. |
submit | Submits the form specified, optionally setting the submitname hidden input field to the value of submitName to let the Form component on server know which button caused the submission. |
cancel | Submits the form to the server in “cancel” mode, invoking any cancel listeners registered to the server side equivalent to the form passed in. |
refresh | Submits the form to the server in “refresh” mode, invoking any refresh listeners registered to the server side equivalent to the form passed in. |
submitAsync | Does almost the same thing as tapestry.form.submit, but submits the request via XHR to the server asynchronously. |
Reference to form element/element id of field that should currently recieve focus, if any
focusField:function( field )
If possible, brings keyboard input focus to the specified field.
field | The field(field id) of the field to focus. |
Function deprecated in favor of dojo equivalent, like dojo.html.selectInputText(node).
registerForm:function( id, async, json )
Registers the form with the local forms property so that there is a central reference of all tapestry forms.
id | The form(form id) to register. |
async | Boolean, if true causes form submission to be asynchronous. |
json | Boolean, if true causes form submission to be asyncrhronous with an expected JSON response. |
registerProfile:function( id, profile )
Registers a form validation/translation profile. There can potentially be more than one profile registered with a form.
The profiles will be consulted at various points in the forms life, which currently only involves running the profile checks before form submission. (more points to be determined in the future)
<dojo.validate.check>
id | The form(form id) to register profile with. |
profile | The object containing all of the validation/value constraints for the form. |
clearProfiles:function( id )
Clears any previously registered validation profiles on the specified form. Normally called during XHR requests by returned JS response to ensure new validation logic coming in from potentially new form fields is accounted for.
id | The form id to clear profiles for. |
setFormValidating:function( formId, validate )
If a form registered with the specified formId exists a local property will be set that causes validation to be turned on/off depending on the argument.
formId | The id of the form to turn validation on/off for. |
validate | Boolean for whether or not to validate form, if not specified assumes true. |
submit:function( form, submitName, parms )
Submits the form specified, optionally setting the submitname hidden input field to the value of submitName to let the Form component on server know which button caused the submission. (For the case of submit button listeners).
form | The form(form id) to submit. |
submitName | Optional submit name string to use when submitting. This is used to associate a form submission with a particular component, like a Submit/LinkSubmit/etc.. |
parms | Optional extra set of arguments that can control the form submission semantics such as url/async/json/etc. |
cancel:function( form, submitName, parms )
Submits the form to the server in “cancel” mode, invoking any cancel listeners registered to the server side equivalent to the form passed in.
form | The form(form id) to cancel. |
submitName | Optional submit name string to use when submitting. This is used to associate a form submission with a particular component, like a Submit/LinkSubmit/etc.. |
parms | Optional object parms passed through to tapestry.form.submit(). |
refresh:function( form, submitName, parms )
Submits the form to the server in “refresh” mode, invoking any refresh listeners registered to the server side equivalent to the form passed in.
form | The form(form id) to refresh. |
submitName | Optional submit name string to use when submitting. This is used to associate a form submission with a particular component, like a Submit/LinkSubmit/etc.. |
parms | Optional object parms passed through to tapestry.form.submit(). |
submitAsync:function( form, content, submitName, parms )
Does almost the same thing as tapestry.form.submit, but submits the request via XHR to the server asynchronously.
form | The form(form id) to submit. |
content | Optional content map, mainly used to pass in browser event parameters to form submission, but can be any typical form/value pair. |
submitName | Optional submit name string to use when submitting. |
parms | Optional set of extra parms that can override the defautls for this specific form submission, like the url/async/json behaviour of the submission. |
If possible, brings keyboard input focus to the specified field.
focusField:function( field )
Registers the form with the local forms property so that there is a central reference of all tapestry forms.
registerForm:function( id, async, json )
Registers a form validation/translation profile.
registerProfile:function( id, profile )
Clears any previously registered validation profiles on the specified form.
clearProfiles:function( id )
If a form registered with the specified formId exists a local property will be set that causes validation to be turned on/off depending on the argument.
setFormValidating:function( formId, validate )
Submits the form specified, optionally setting the submitname hidden input field to the value of submitName to let the Form component on server know which button caused the submission.
submit:function( form, submitName, parms )
Submits the form to the server in “cancel” mode, invoking any cancel listeners registered to the server side equivalent to the form passed in.
cancel:function( form, submitName, parms )
Submits the form to the server in “refresh” mode, invoking any refresh listeners registered to the server side equivalent to the form passed in.
refresh:function( form, submitName, parms )
Does almost the same thing as tapestry.form.submit, but submits the request via XHR to the server asynchronously.
submitAsync:function( form, content, submitName, parms )