<script type="text/javascript"> //first we add the new field to validanguage.el validanguage.el.newDateField = { errorMsg: 'You must enter a valid date', validations: [ { name: 'validateRequired' }, { name: 'validateDate' } ] } //Next we load the new validations with validanguage.addValidation() //Note that the new validations must be loaded with the array syntax below, //using "validateRequired, validateDate" will not work validanguage.addValidation( 'newDateField', ['onsubmit', 'onblur'], ['validateRequired', 'validateDate'] ); //Instead of listing both validations individually, you could also use the following: validanguage.addValidation( 'newDateField', ['onsubmit', 'onblur'], '*' ); </script>
<script type="text/javascript"> validanguage.removeValidation( 'newDateField', ['onsubmit', 'onblur'], ['validateRequired', 'validateDate'] ); //Or, instead of listing the eventTypes and validations indivudally, //you can deactivate them all with the following: validanguage.removeValidation( 'newDateField', '*', '*' ); </script>
The isAjax support is primarily for advanced users who have a knowledge of server-side programming. In order to utilize the caching and discarding of outdated requests you will need to integrate the ajaxCounter variable into your ajax calls so that it is sent to the server and then returned inside the response (most likely via JSON encoding). To enable this, any function labelled with isAjax will be called with the form field value as the first argument and an incremented ajaxCounter value as the second argument.