Solved

How to validate  a Date field with JQuery

Posted on 2010-08-30
8
744 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP: Filling Out/Creating a PDF 29 97
pass foreach data in php into jquery ajax 10 46
replacing inline javascript with jquery 4 45
Slush on text 2 11
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

756 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