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 

Preselecting one or more dates on MultiPicker calendar

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



Joined: 20 Mar 2008
Posts: 2

PostPosted: Sat Mar 29, 2008 6:48 pm    Post subject: Preselecting one or more dates on MultiPicker calendar Reply with quote

I recently installed the MultiPicker calendar. The calendar is part of a larger ColdFusion form, and I am currently able to select one or more dates using the calendar, and pass those dates into a database. My form processing page parses the date(s) passed via the allSelected form field and inserts each individual date into SQL Server.

I would like to be able to reverse this process -- select one or more dates from the SQL Server table, and have them be preselected on the calendar. I can put the date(s) into any format necessary for the calendar to read them; I just don't know which javascript function can take a series of dates and preselect them on the calendar. I only need to preselect the dates; no other information needs to be displayed on the calendar.

As an example, let's say that I am using the MultiPicker to select dates during which training classes will occur, and each class takes place over three days. I might select April 1, April 3, and April 5 using the MultiPicker in my form, and then pass those dates into my database using the allSelected form field, along with my other form fields.

Now let's say that I want to be able to edit the information for my class, including the dates. This means I need to pull all the information about the class from my database, and display it in a new set of HTML form fields, by prepopulating the fields with the info from the database. When I am finished editing the information, the form processing page updates the database with the new information, no matter if I updated just one field or all of them.

Using the example above, when I go to edit this class' information, I would like to have April 1, April 3, and April 5 preselected on the calendar. If I don't need to edit the dates, these three dates will be passed back into the database in the allSelected field, as if I were inserting them for the first time. But if the dates need to change, then I need to be able to deselect the old dates and select new dates.

Can you please suggest the best way to preselect one or more dates using the MultiPicker calendar? I understand how to add agenda events to the calendar, but I didn't think this was appropriate for my situation, since I only need to be able to preselect a series of dates. I don't need to display any other information using the calendar. I also don't need to show the preselected dates in a different color than the usual "selected" color.

Thank you.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Sun Mar 30, 2008 3:54 am    Post subject: Reply with quote

It's actually been detailed in the MultiPicker Demo page already - all you need to preselect dates is just to generate the fInitAgenda() function properly.

The following is a quick example in JSP:
Code:

<script>
... other scripts....
function fInitAgenda() {
   with (gfFlat) {
<% ... load data from db to resultset...
for (row in resultset) do { %>
      fAddRange(<%=row[0]%>,<%=row[1]%>,<%=row[2]%>,false);
<% } %>
      if (gRange.length>0) fRepaint();
   }
}
</script>

Once the page is loaded in browser, the fInitAgenda() would have been generated by JSP or Coldfusion scripts, and the calendar engine will in turn call the fInitAgenda() automatically (from plugins.js) and pre-select all dates with the fAddRange() calls.

The key to understand this is to differentiate the run time of server-side script from the client-side script - coldfusion or JSP are server-side, we use them to generate the whole page and supply the result to the browser, including the client-side javascript. Afterwards, the client-side script gets executed by the browser and preselect dates in the calendar.

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



Joined: 20 Mar 2008
Posts: 2

PostPosted: Tue Apr 01, 2008 12:51 pm    Post subject: Thanks Reply with quote

I appreciate the quick reply. I had forgotten that the demo provided guidance on dynamically preselecting dates.
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