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 Quote
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? Quote
swati Posted November 12, 2010 Author Report Posted November 12, 2010 Yes, you are right. I am using the same. Quote
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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.