Called when validation of the form is needed.
onValidate = function(event)
This event is triggered when validation of the form is called. The event handler will receive a list of errors.
You can add event listener during the object creation: $('#form').w2form({ name : 'form', url : 'server/post', record: { field_1 : 1, field_2 : 2 }, fields: [ { name: 'field_1', type: 'text', required: true }, { name: 'field_2', type: 'alphanumeric', required: true } ], onValidate: function(event) { console.log(event); } }); or after the object has been created: w2ui.form.on('validate', function(event) { console.log(event); }); The event handler is called before the default action of the event is triggered. You can cancel the default action by calling event.preventDefault(). To perform an action after the event is fully processed, define event.onComplete function.
See events page in utilities for more details.

#### Example of Custom Validation

Lets say you want to make sure that registration date user provided is before the submission date. The following function will do this check and display error message if needed. onValidate: function(event) { var date1 = w2utils.isDate(this.record.date1, null, true); // returns JS Date object var date2 = w2utils.isDate(this.record.date2, null, true); // returns JS Date object if (date1 > date2) { event.errors.push({ field: this.get('date1'), error: 'Registration date should be prior to submission date' }); }