swati Posted November 12, 2010 Report Posted November 12, 2010 Hi, I want to validate a date field in the format : DD - single textbox MM -single textbox YYYY -single textbox Three textbox fields are there, have to do the separate validation for date(DD),month(MM),year (YYYY) var v_myProfileEditForm = $("#myProfileEditForm").validate({ rules: { title: { required: true }, name: { required: true }, lname: { required: true }, dob:{date: true, dateOfBirth: true} }, this dob rule wont work for me, can you help me out for these 3 fields separate validations ? Thanks
falkencreative Posted November 12, 2010 Report Posted November 12, 2010 What validator are you trying to use? I'm assuming some sort of jQuery plugin?
swati Posted November 12, 2010 Author Report Posted November 12, 2010 Yes, you are right. I am using the same.
falkencreative Posted November 12, 2010 Report Posted November 12, 2010 I believe you are using this, correct? http://docs.jquery.com/Plugins/validation To be honest, I wouldn't use text boxes for this. I would use three dropdown select boxs instead (or two selects for day/month and a text input for year?) Day would range from 1-31, month from 1-12, etc. Then you just need to make sure that a value for each field has been selected. If you do text boxes, seems like you would want to use digits() to confirm you are only dealing with numbers, and you could use range() (http://docs.jquery.com/Plugins/Validation/Methods/range#range) to specify the range of numbers that are available.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now