Taras schrieb:
Hello jQuery Team:)

Sorry for banal question, but I have not found answet to it in the
web.
So, I have simple html form and I want to validate it using jQuery
validation plugin. Everything is fine? but I want to change validation
event. In documentaion it is said that,

"
By default, forms are validated on submit, triggered by the user
clicking the submit button or pressing enter when a form input is
focused (option onsubmit). In addition, once a field was highlighted
as being invalid, it is validated whenever the user types something in
the field (option onkeyup). When the user enters something invalid
into a valid field, it is also validated when the field loses focus
(option onblur).
"

Can I change it to make validation immediate, for example "onchange"
event + on submit?
I was trying to configure jQuery like this :
"
$j(document).ready(function(){
   $j("#bookForm").validate({
                defaults: {
                        immediate: true
                },
          event: 'change',
          onsubmit: true,
          rules: {
            title: {
                required:       true,
                maxLength:      <c:out value='${BOOK_TITLE_MAXSIZE}' />
            },
             ....

"
but it doesnt works for me.
Please, advise
There is no defaults or event option. But you can provide an onkeyup option that always validates:

$(...).validate({
 onkeyup: function(element) { this.element(element); },
 ...
});

Jörn

Reply via email to