CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Default Start Date and End Date upon Page Load

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> PopCalendarXP Related
View previous topic :: View next topic  
Author Message
prbureau



Joined: 26 Jan 2007
Posts: 5

PostPosted: Tue Feb 06, 2007 11:02 am    Post subject: Default Start Date and End Date upon Page Load Reply with quote

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
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Tue Feb 06, 2007 1:36 pm    Post subject: Reply with quote

Yes, and it's detailed in the following FAQ:

http://www.calendarxp.net/forum/viewtopic.php?t=66

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
prbureau



Joined: 26 Jan 2007
Posts: 5

PostPosted: Wed Feb 07, 2007 9:47 am    Post subject: Reply with quote

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

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
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Wed Feb 07, 2007 1:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
prbureau



Joined: 26 Jan 2007
Posts: 5

PostPosted: Thu Feb 08, 2007 5:31 am    Post subject: Reply with quote

That solves the problem.

OK Thank you so much! Very Happy

Best Regards
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> PopCalendarXP Related All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group