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 

How do i enter custom data into a field when i click a date?

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



Joined: 13 Mar 2005
Posts: 8

PostPosted: Mon Mar 14, 2005 7:04 pm    Post subject: How do i enter custom data into a field when i click a date? Reply with quote

Hi,

Ive got a php coded agenda.js. When I click a date, I want it to update a field on the page with the data obtain from agenda.js.

So if 25th May shows Holiday, when I click on that date, a text box on the page shows "25th May - Holiday"

Is this possible?
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Mon Mar 14, 2005 7:22 pm    Post subject: Re: How do i enter custom data into a field when i click a date? Reply with quote

Yes, it's quite possible. You just need to put the following into fAfterSelected plugin, e.g.
Code:
function fAfterSelected(y,m,d,e) {
  var holiday=fHoliday(y,m,d);
  if (holiday!=null)
    gContainer.document.demoForm.yourBoxField.value=holiday[0];
}

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



Joined: 13 Mar 2005
Posts: 8

PostPosted: Tue Mar 15, 2005 12:39 pm    Post subject: Reply with quote

Thanks for that. Where do i put the information in the agenda.php file? Say I want My Holiday 7 to appear when I click the 14th June?
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Tue Mar 15, 2005 3:41 pm    Post subject: Reply with quote

nickand wrote:
Thanks for that. Where do i put the information in the agenda.php file? Say I want My Holiday 7 to appear when I click the 14th June?

In the last reply I set the field with the message you passed in when you set up the agenda, therefore you can use the following in the fHoliday():
Code:
function fHoliday(y,m,d) {
  if (m==6&&d==14)
    return ["My Holiday 7", ""];
  ...
}

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



Joined: 13 Mar 2005
Posts: 8

PostPosted: Wed Mar 16, 2005 7:32 pm    Post subject: Reply with quote

Thanks for the info. Just one more question. Is this possible?

Can I send 3 diferent text's over so that I can populate 3 different fields with information? Is there an easy way to do this? Maybe a field for a name, another for the date and another for info?

Nick
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Wed Mar 16, 2005 7:50 pm    Post subject: Reply with quote

Yes, you may use the last param of the agenda to carry whatever you like, more details can be found in the "agenda tutorial". e.g. use the following in agenda.js
Code:
fAddEvent(2005,3,16,"My Holiday 7", "", null, null, null, null, null, "xyz");

Then change the fAfterSelected plugin to be like:
Code:
function fAfterSelected(y,m,d,e) {
  var holiday=fHoliday(y,m,d);
  if (holiday!=null) {
    var fm=gContainer.document.demoForm;
    fm.field1.value=holiday[0];
    fm.field2.value=y+'-'+m+'-'+d;
    fm.field3.value=holiday[7];
  }
}

NOTE: you may replace the "xyz" string with any object, even an array, then retrieved it later via the holiday[7].

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



Joined: 13 Mar 2005
Posts: 8

PostPosted: Wed Mar 16, 2005 9:33 pm    Post subject: Reply with quote

Ah great, so i can keep going? So simple when you know how!

Thanks for your quick reply and great support once again!
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 -> FlatCalendarXP 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