1

Ive been looking at this for hours and I figure I'll ask here before pulling my hair out. I am doing a form validation. all is well except ONE field: Im sure it is something stupid.

<input name="Credit Card Number" style="width:150px;" title="Credit Card Number" id="billingCC" type="text" class="textboxpg2" maxlength="50" autocomplete="off" onKeyUp="highlightCC(this.value);">

here is the deal. when I just add the required class it works just fine. when I try to add the rule instead, it doesnt find the field invalid. everything else in the form, all other validations, work fine. just this one. I have tried it without the onkeyup javascript to make sure that it wasn't interfering, and its not the issue. please please point out the stupid error i am sure i am making. I am not getting anything in error console, and aside from that the form validates fine. THANKS!

The rule

        billingCC: {
        required:true,
        creditcard:true,
        number: true,           
    },

the message

billingCC: "Invalid credit card number",
1
  • The trailing comma in the object literal will stop old versions of Internet Explorer working properly. That probably isn't the issue, but you should remove it anyway. Commented May 23, 2011 at 21:08

1 Answer 1

1

The validate plugin uses the name attribute, not the id, so it's not finding it. Try this:

<input name="billingCC" style="width:150px;" title="Credit Card Number" id="billingCC" type="text" class="textboxpg2" maxlength="50" autocomplete="off" onKeyUp="highlightCC(this.value);">
Sign up to request clarification or add additional context in comments.

1 Comment

seeing my first ever stack overflow question nearly 12 years later, almost brings a tear to my eye, hah. Thanks Shane!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.