How to add custom validation on w2ui?
<p>I've two fields ReasonDate and RegistrationDate. According to business logic RegistrationDate cannot be earlier than ReasonDate. I'm checking in 'onValidate' event handler of form like this:</p>

<pre><code>onValidate: function(event) {
    var pattern = /(\d{2})\.(\d{2})\.(\d{4})/;
    var reasonDt = new Date(w2ui.form.record.ReasonDate.replace(pattern, '$3-$2-$1'));
    var registrationDt = new Date(w2ui.form.record.RegistrationDate.replace(pattern, '$3-$2-$1'));

    if (reasonDt &gt; registrationDt) {
        $('#ReasonDate').w2tag('@TranslateText("accard_ReasonDateShouldLessThanRegDate")');
        //$('#ReasonDate').addClass('w2ui-error');
    }
},
</code></pre>

<p>and on button click I'm validating like this:</p>

<pre><code>add: function () {
    $('#BudgOrgTin').removeClass('w2ui-error');
    var errors = w2ui.form.validate(true);
    if (errors.length &gt; 0) {
        return;
    }
</code></pre>

<p>How to add correctly my error message so that when I validate form it returns my error too?</p>