Is there a way to call multiple fields into one remote: call in the
validate script?  I have a credit card validation that is dependent on
the card selected in an above select box.

Example:

$(document).ready(function(){
      var options = {
        target:        '#formResult',   // target element(s) to be
updated with server response
        beforeSubmit:  showRequest,  // pre-submit callback
        success:       showResponse,  // post-submit callback
        url:           '../ajax/myPaymentInfo_Submit.php',
        type:          'POST'

      };
        var validator = $("#MyPaymentInfo").validate({

                /* Set up rules for each required field.  Make it so
thatat
                 * fields are only valid if their appropriate radio
button is
                 * checked.
                 */
                rules: {
                          PrimaryCCType: {
                                required: true
                        },
                        PrimaryCCNumber: {
                                required: true,
                                remote: "../ajax/
validateCreditCard.php"
                         },
               mesages: {
                               PrimaryCCType: {
                                required: "Please Select a Credit Card."
                        },
                        PrimaryCCNumber: {
                                required: "Please Enter Your Credit Card",
                                remote: "This is not a valid Card
Number"
                              },
                // the errorPlacement has to take the table layout into account
                errorPlacement: function(error, element) {
                        $('#errordiv').show();
                        error.appendTo(element.next());
                },
                // specifying a submitHandler prevents the default submit, good 
for
the demo
                submitHandler: function(MyPaymentInfo) {
                         jQuery('#MyPaymentInfo').ajaxSubmit(options);
                }
        });
    });

An example of the forms:

<select id ="PrimaryCCType" name="PrimaryCCType">
<option value="">--</option>
<option value="1">Visa</option>
<option value="2">MasterCard</option>
<option value="3">American Express</option>
<option value="4">Discover</option>
</select>

<input type="text" name="PrimaryCCNumber" size="30" />




Jquery is not my strong point, so any help is greatly appreciated.

Thank you so much!!

Reply via email to