3 Replies Latest reply on Feb 24, 2008 3:31 PM by RC13

    CFCalendar in loop?

      Is it possible to create multiple <CFCalendar> tags in a loop?

      I have a loop that creates a unique form for each record in a result set. My goal is to create a calendar for each of the records and use the form to allow updates to a due_date field related the record. I have used the following code (stripped down to include only necessary sections) to attempt this. When I do, only the first CFCalendar loads. I assume this has something to do with how the CFCalendar is integrated with javascript.

      Is there anyway to accomplish this?

      <cfloop query = "DueDateResultSet" >
      <cfform format="html" name="CalenderForm_#DueDateResultSet.order_unit_id#" action="DueDate_Update.cfm" >
      mask="mmm dd, yyyy"
      monthNames="JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC"
      width="200" height="150"
        • 1. Re: CFCalendar in loop?
          Dan Bracuk Level 5
          I don't know why your calendar does not load, but I'm curious about why you have more than one form. The user can only submit one of them.

          By the way, I see no cfoutput tag. Is that something you stripped away for brevity?

          Finally, how many records did your query return?
          • 2. Re: CFCalendar in loop?
            RC13 Level 1
            I went with separate forms as the requirements call that the user should only submit one update. In fact, the business rules never call for a scenario to be updating more than one at a time so I thought it would be easier just to break them out as individual forms.

            Regarding the <cfoutput> tags. I do not have cfoutput tags around the calendar section, but it does not appear to be affecting the dynamic outputing of my calendar name. When I do a view on source of the output page, I see name="Calendar_6665758" which is what I expected. I tried to include the <cfoutput> around the <cfcalendar> but it did not make a difference.

            The query is returning 2 records.
            • 3. Re: CFCalendar in loop?
              RC13 Level 1
              Well.. not sure why, but when I pull the <cfform> tags out of the loop, it did work successfully showing a new calendar for each row. Thanks Dan for leading me in the right direction with your question.