<we:checkForm>
Since version: 3.2.0.0 | Requires endtag: yes
Description
The we:checkForm tag validates the entries of a form with Javascript. The combination of the parameters 'match' and 'type' determine the 'name' or the 'id' of the form to check. 'mandatory' and 'email' contain a commaseperated list of mandatory or e-mail fields. In 'password' it is possible to insert 2 names of fields and a minimum length of inserted passwords. With 'onError' you can choose the name of an individual Javascript-function which is called in case of an error. This function will get an array with the names of missing mandatory and email fields and a flag, if the password was correct. If 'onError' is not set or the function does not exist, the default value is displayed in an alert-box.
Specific
This tag only works if the web-browser supports the Javascript DOM-Model and Javascript is activated.
Attributes
match
Default value: - | since version: 3.2.0.0 | required: yes
Set this attribute to the "name" or "id" of the form to check.
type
Default value: - | since version: 3.2.0.0 | required: yes
Here , you can set the attribute "match" to reference to the "id" or the "name" of the Form.
Allowed values:
- id
- name
mandatory
Default value: - | since version: 3.2.0.0 | required: no
Enter a comma seperated list of mandatory fields for the form.
Default value: - | since version: 3.2.0.0 | required: no
Enter a comma seperated list of Email-fields of the form. These will be checked for a correct syntax.
password
Default value: - | since version: 3.2.0.0 | required: no
The password attribute requires the input of two password fields and the min. length of the password. The passwords are checked for compliance and min. length.
onError
Default value: - | since version: 3.2.0.0 | required: no
With the "onError" attribute, you are able to use your own Javascript-function to be called in the case of an error. It contains a reference to the form, an array with the names of the missing mandatory fields, an array with the names of the Email fields with wrong syntax, and a flag, indicating the correctness of the password entry. If, e.g., you want to call a function called "errorHandler", use the following code.
<we:checkForm .. onError="errorHandler" .. >
<script type="text/javascript">
function errorHandler (form,missingReq,wrongEmails,passwordError) {
}
</script>
The parameters: form: Reference to the Javascript form object missingReq: Array consisting of the names of all missing mandatory fields wrongEmails: Array consisting of the names of all Email addresses with wrong syntax passwordError: true, if an error occurs with the password input (not equal; too short).
jsIncludePath
Default value: - | since version: 3.2.0.0 | required: no
For this webEdition-tag, a Javascript file is included, which is located within the webEdition directory ("/webEdition/js/external/weCheckForm.js"). If your webEdition directory is password protected, you can copy this file to an unprotected directory on your webserver and set the path using the "jsIncludePath" attribute.
cachelifetime
Default value: 0 | since version: 4.2.0.0 | required: no
With this attribute you define the validity of the Cache in seconds for this we:Tag. This attribute is used only if cache type defined in the template is we:Tag Cache or Cache is disabled.
Syntax
<we:checkForm match="attribute" type="id|name" [mandatory="attribute"] [email="attribute"] [password="attribute"] [onError="attribute"] [jsIncludePath="attribute"] [cachelifetime="attribute"]> ... </we:checkForm>
Examples
Example
<we:checkForm match="newsletter" type="id" mandatory="name,address,zip,city,we_subscribe_email__," email="we_subscribe_email__" onError="dealFormError">Please check the form</we:checkForm>