I'm trying to validate a form.

All the validation I've implemented up to this point
is working fine.

However, I want to be able to scan all required fields
after each field is filled in and see if any required
fields remain to be satisfactorily completed.  If there
are any, I want to keep the submit button on my form
disabled.

I'm trying to use this code:

$(':input.required').each(function() {
     var val = (this.value.length);
     if (val == 0)
        { $('#submit').attr('disabled', 'disabled'); };
});

However, each time I fill in a required field, the submit
button is enabled.  (I realize for now that the code above
is only checking length and I can add other checks later,
but wanted to get this one working first.

Any clues?

Thanks,

Rick

Reply via email to