Hi There,
I could use some help here.  I need to place a condition statement
(if) in this form validation script.  For some reason, I just can't
get it to work.  Basically, when a user un-checks a particular box
(billing_addr) additional form fields slide down, those fields need to
be validated.  If the box is checked the fields roll-up, become
disable and can be skipped.  What's the best way to accomplish this?

Thanks,
MD

$(document).ready(function() {
        var billing_address = $("input[name='billing_addr']:!checked").val();
        $.metadata.setType("validate");
        $('#mysampleform').validate({
                rules: {
                        first: "required",
                        last: "required",
                        address: "required",
                        city: "required",
                        state: "required",
                        country: "required",
                        zip: "required",
                        membertype: "required",
                        amount: "required",
                        state: "required",
                        mt: "required",
                        email: true,

                        if (billing_address == 1) {
                                alert(billing_address);
                                billing_first: "required",
                                billing_last: "required",
                                billing_address: "required",
                                billing_city: "required",
                                billing_state: "required",
                                billing_zip: "required",
                                billing_email: true
                        }
                },
                messages: {
                        first: "Please enter your first name",
                }
        });
});

Reply via email to