View previous topic :: View next topic |
Author |
Message |
prbureau
Joined: 26 Jan 2007 Posts: 5
|
Posted: Tue Feb 06, 2007 11:02 am Post subject: Default Start Date and End Date upon Page Load |
|
|
Hi,
Just want to ask if it's possible to set the begin date 2 weeks ahead of the current date and the end date 2 days later than the begin date when the page is loaded? What are the codes to be inserted or modified? We are using DateRange.
Thanks alot!
John
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
|
Back to top |
|
|
prbureau
Joined: 26 Jan 2007 Posts: 5
|
Posted: Wed Feb 07, 2007 9:47 am Post subject: |
|
|
We want the date to have value when the page is loaded.
We tried this one (this is on your facts section):
Code: | <body onload="document.frm_Search.dc1.value=gfPop.fFormatInput(gfPop.gToday[0],gfPop.gToday[1], gfPop.gToday[2]+14)"> |
The day today is 07/02/2007 and the output for this is 21/02/2007 but when we changed it to this:
Code: | <body onload="document.frm_Search.dc1.value=gfPop.fFormatInput(gfPop.gToday[0],gfPop.gToday[1], gfPop.gToday[2]+30)"> |
the output is 37/02/2007 which is not correct.
But the example above is just for the start date. We want both start date and end date to have values when the page is loaded.
for example today is 07/02/2007
so the output will be:
start: 21/02/2007
end: 23/02/2007
Look at this page for an actual example: http://hotels.co.uk
I think this also used calendarxp.
Thank you so much!
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Wed Feb 07, 2007 1:43 pm Post subject: |
|
|
It's because fFormatInput() won't validate the date. All you need is following:
Code: | <script>
function presetDate(fm) {
var dt=new Date(gfPop.gToday[0],gfPop.gToday[1]-1,gfPop.gToday[2]+30);
fm.dc1.value=gfPop.fFormatInput(dt.getFullYear(),dt.getMonth()+1,dt.getDate());
}
</script>
<body onload="presetDate(document.frm_Search)"> |
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
prbureau
Joined: 26 Jan 2007 Posts: 5
|
Posted: Thu Feb 08, 2007 5:31 am Post subject: |
|
|
That solves the problem.
OK Thank you so much!
Best Regards
|
|
Back to top |
|
|
|