Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6847969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:48:35+00:00 2026-05-27T00:48:35+00:00

I am using the jQuery Validation plugin to validate a signup form for my

  • 0

I am using the jQuery Validation plugin to validate a signup form for my site. One of the required things a user must do is enter their birthday, they have to be 18 to use the site. I am having the birthday entered through three dropdown menus. I want to validate this entry (to make sure they did it and to make sure they are at least 18, but I am failing to understand the building of custom validators. Here is my code in the form:

<p>
            <label for="user_birthday">Birthday</label>
            <br>
            <select id="user_birthday_2i" name="user[birthday(2i)]">
            <option value="1">January</option>
            <option value="2">February</option>
            <option value="3">March</option>
            etc....
            </select>
            <select id="user_birthday_3i" name="user[birthday(3i)]">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            etc...
            </select>
            <select id="user_birthday_1i" name="user[birthday(1i)]">
            <option value="2010">2010</option>
            <option value="2011">2011</option>
            etc...
            </select>
          </p>

Anyone ever built a validator like this before using the jQuery Validation plugin?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:48:35+00:00Added an answer on May 27, 2026 at 12:48 am

    I was using the jQuery Validation Plugin, and it was working well, so I wanted to stick with it. Basically I had to add a custom validator, and ended up using the date.js library to interpret the date. Like so:

    # formats the date into a hidden field that can be validated when the dropdowns are changed.
    $('#user_birthday_3i,#user_birthday_2i,#user_birthday_1i').change(function() {  
          $('#user_birthday').val($('#user_birthday_3i').val()+'/'+ $('#user_birthday_2i').val()+'/'+ $('#user_birthday_1i').val());
        });
    
    
    # uses date.js to interpret the date and do a little math
    jQuery.validator.addMethod("ofAge", function(value, element) { 
            return Date.parse($("#user_birthday").val()) < (18).years().ago();
        }, "You must be 18 years old to join.");
    
    
    # validated the form using the jquery validation plugin
    $("#new_user_signup").validate({
        rules: {
            "user[birthday]": {
                required: true,
                date: true,
                ofAge: true
            }
        },
        messages: {
            "user[birthday]": {
                required: "Please enter your birthday.",
                date: "Please enter your birthday."
            }
        }
    });
    

    Not sure if it was the best method, overall, but it worked for me!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jquery validation plugin to validate my form. I have one field
I'm using jQuery validation plugin to validate a form. when one thing is selected
I am using jquery validation plugin to validate a registration form. Each text input
I am using the jquery validation plugin to validate a form. I have the
I am using the jquery form validation plugin to validate a long form. If
I am using JQuery validation plugin to validate my form. I have a radio
I'm using the jQuery validation plugin to validate a form, and I'd like to
I am using jquery and jquery.validate.cs (jQuery Validation Plugin 1.8.0) to validate a form.
I am using jQuery validation plugin to validate my form, but it is seems
I'm using this jQuery validation plugin and getting the famous: $(#Form).validate is not a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.