Solved

How to validate  a Date field with JQuery

Posted on 2010-08-30
8
745 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Execute jQuery after Function 4 41
Time Picker 3 22
Form submit takes only for one form 23 54
Error just appeared 3 23
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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)

751 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