Solved

How to validate  a Date field with JQuery

Posted on 2010-08-30
8
741 Views
Last Modified: 2013-11-08
Hi Experts,
I am a Jquery newbie.  I am making a webpage where I am using date picker in Jquery to supply the calender for two input fields. I want to validate the date after the selection is done or the user types a date on his own.
Also the first input field is checkin and the second one is check out. So I need also make sure that they can't select the same date in the check out field as they do in check in date
can you please  help me figure this out?
Thanks in advance guys
0
Comment
Question by:guyneo
  • 4
  • 3
8 Comments
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 150 total points
ID: 33569257
you need to parse the date into the date object and then check for equality (assuming that both dates are in different format, else just a if condition will suffice)
use Datejs for doing parsing
http://www.datejs.com/
0
 
LVL 14

Expert Comment

by:sam2912
ID: 33571065
Please post a link to your page.
0
 
LVL 1

Author Comment

by:guyneo
ID: 33573407
@gurvinder I will give it a try. I am wondering if Jquery validate plugin will be able to do this with ease?
0
 
LVL 14

Expert Comment

by:sam2912
ID: 33574075
I don't mean to be rude, but the more information you provide to us regarding your problem the faster you will receive a solution that you can implement quickly, rather than having everyone to guess (or even skip over) your question. If you had provided your page code, somebody might have already coded the solution for you.

Regards
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Author Comment

by:guyneo
ID: 33583943
No offense taken Sam. What you say is right.
However the developement machine and hence the webpage is not accesible from outside. So I can't post the link. I can post the relevant part of the form if that would help to get an idea of what I need.  It is a basic book/document library application   The webpage I am trying to validate is pretty simple. Regular Date fields: One field for checkOut and One for CheckIn.
0
 
LVL 14

Expert Comment

by:sam2912
ID: 33585263
Okay. What is the format of the date you are trying to validate? DD/MM/YY?
0
 
LVL 1

Author Comment

by:guyneo
ID: 33586016
Yes. or   DD/MM/YYYY
0
 
LVL 14

Accepted Solution

by:
sam2912 earned 350 total points
ID: 33587017
You could do something like this
foo50---Validate-DatePicker.html
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now