Results 1 to 2 of 2

Thread: JQuery and form validation

  1. #1
    Join Date
    Jan 2008

    JQuery and form validation

    Hey everyone.

    I am using jquery and the form validation plugin from http://bassistance.de/jquery-plugins...in-validation/.

    I have a form that accepts credit card payments. I want 1 error message to show up if either the month or the year is not selected. Currently, I have class="required" on both select fields, so 2 error messages will show up.

    I cant find much (helpful) documentation on the validation plugin, so if someone knows a way to do this, id appreciate a code snippet.

    Current Result:

    Desired Result:

    To validate, I'm simply using:
    And my HTML is like so:
    HTML Code:
    <select name="ccxmonth" id="ccxmonth" class="required">
    <select name="ccxyear" id="ccxyear" class="required">
    Need help bringing your website to life? http://www.nickelleon.com

  2. #2
    Join Date
    Mar 2007
    Well not familiar with that plug in, but you could use jquery to get the value of the select input using $("#ccxmonth").val(); You'd then add the if/then logic for if the value equals the starting value then throw the error. You'd compare it to the starting value because if it equals that you'd know it hasn't changed. This works as long as your starting value is nothing or "Select a date..." something like that, that isn't a real option.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center