I've got a user contact information form, which has among other fields
an e-mail address field. The e-mail address field has a "test"
function that allows the user to send a test e-mail message to confirm
that the e-mail address is indeed correct. However, the e-mail address
isn't required in order to save the user contact information form, so
I've got it defined as:

<label for="emailaddress">E-Mail address</label>
<input type="text" name="emailaddress" class="{validate:
{required:false,email:true}}" />
<a href="#" onclick="testEmailAddress(); return false;">Test</a>

And my validator set up simply as
$(document).ready(function() {
    validator = $("#form").validate({
        meta: "validate"
    });
});

Although the e-mail address isn't required to submit the form, it
should be required for the test e-mail function, so in my
testEmailAddress(), I'd like to validate the particular field as if
required: true, in addition to the standard submit rules. What's the
proper way to go about this? I couldn't figure out how to use a
depends clause or a custom validator callback that would depend on
what button was pressed or something of the sort.

Thanks,
Jason

Reply via email to