| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|
|
#1 (permalink) |
|
Junior Member
Join Date: Feb 2007
Age: 24
Posts: 4
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2
|
hi ,
i need to validate and check two date fields startdate and enddate so that the enddate must be greater than the startdate in javascript. can any one help me ? bala |
|
|
|
|
|
#2 (permalink) |
|
Moderator
Join Date: Jul 2006
Posts: 2,186
Thanks: 5 Thanked 402 Times in 275 Posts Thanks: 5
Thanked 402 Times in 275 Posts
Rep Power: 62
|
Re: doubt in javascript (urgent)
Check dis link, hope u vil get answer.........
Performing Form Validation with Validation Controls > Comparing Values: The CompareValidator Control
__________________
Kiran |
|
|
|
|
|
#3 (permalink) |
|
Super Moderator
Join Date: Feb 2006
Location: Hyderabad
Posts: 2,355
Thanks: 117 Thanked 255 Times in 206 Posts Thanks: 117
Thanked 255 Times in 206 Posts
Blog Entries: 4
Rep Power: 53
|
Re: doubt in javascript (urgent)
function getDateObject(dateString,dateSeperator)
{ //This function return a date object after accepting //a date string ans dateseparator as arguments var curValue=dateString; var sepChar=dateSeperator; var curPos=0; var cDate,cMonth,cYear; //extract day portion curPos=dateString.indexOf(sepChar); cDate=dateString.substring(0,curPos); //extract month portion endPos=dateString.indexOf(sepChar,curPos+1); cMonth=dateString.substring(curPos+1,endPos); //extract year portion curPos=endPos; endPos=curPos+5; cYear=curValue.substring(curPos+1,endPos); //Create Date Object dtObject=new Date(cYear,cMonth,cDate); return dtObject; } var startDate = getDateObject(document.groupForm.Date.value,"/"); var endDate = getDateObject(document.groupForm.endDate.value,"/");[FONT=verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif] [/font]if(startDate < endDate) alert("startDate is less than endDate"); if(startDate >= endDate) alert("startDate is greater than or equal to endDate");
__________________
Give 1 cup rice to a hungry Indian just by a mouse click. No money, no form filling, no hassle... Click here for the donation. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mega Free Download S/W Links A-Z | yathish | OTHERS | 514 | 26-12-08 05:16 PM |
| Openings for JAVASCRIPT MASTERS in Intrasoft Technologies | santhu | FRESHER JOBS | 0 | 20-12-06 07:49 PM |
| Compare Infobase Pvt.Ltd.: HTML Programmer | sridhar | FRESHER JOBS | 3 | 29-08-06 03:51 PM |
| JavaScript Qs Set - 1 | vjsreevs | WEB DESIGNING, DEVELOPMENT ,PROMOTION & SEO | 4 | 07-08-06 10:20 PM |
| JAVASCRIPT INSECURITIES | wizkid | SYSTEM SECURITY & ETHICAL HACKING | 0 | 29-07-06 03:31 PM |