16 Replies Latest reply: Jun 3, 2011 1:26 PM by Adam Cameron. RSS

    cfcalendar won't return selected value

    BreakawayPaul Community Member

      My host runs CF8, and I'm building a website for my wife's business.  I'm trying to use cfcalendar to allow customers to pick appointment dates, but I'm having a problem.

       

      I assumed you get the selected date by submitting the form and looking at #FORM.calendarname# (where calendarname is whatever the name= attrib of the cfcalendar tag).

       

      I'm using it in a cfform with format="html" which is supposedly allowed, but the form returns nothing.  If I switch it format="flash" then it works fine.

       

      Is there any way to get it to work with an HTML form?  I really don't want the entire form to be flash (not to mention that I've heard flash forms are going away in future versions of CF).

        • 1. Re: cfcalendar won't return selected value
          -==cfSearching==- Community Member

          Yes that is how it should work IF you are using method POST. Are you? You can also cfdump both scopes (FORM and URL) at the top of your page to see what values are being passed.

          • 2. Re: cfcalendar won't return selected value
            BreakawayPaul Community Member

            Yes, I'm using post.  I really don't want to use get because I'm passing tons of info that's full of spaces and things.

             

            When I dump #FORM.calendarname# I get: [empty string]

             

            It's looking like I'm about to go snippet hunting for a javascript calendar, which is sort of what I was trying to avoid by using CF.

            • 3. Re: cfcalendar won't return selected value
              -==cfSearching==- Community Member

              I was not suggesting you should use GET. just that you verify you are using the correct variable scope.

               

              When I dump #FORM.calendarname# I get:

               

              Sounds like you did not select a date from the calendar. When you do not select a date, the field value is an empty string.

              • 4. Re: cfcalendar won't return selected value
                -==cfSearching==- Community Member

                It's looking like I'm about to go snippet hunting for a

                javascript calendar, which is sort of what I was trying to

                avoid by using CF.

                 

                You should not need to look too far. IIRC CF8 supports cfinput type="datefield" which is html based (not flash like cfcalendar).

                • 5. Re: cfcalendar won't return selected value
                  BreakawayPaul Community Member
                  -==cfSearching==- wrote:

                  Sounds like you did not select a date from the calendar. When you do not select a date, the field value is an empty string.

                  Oh I selected one alright.  When I have <cfform format="html" and I select a date, I get empty string.  When I have <cfform format="flash" and select a date, I get the date.  It seems like I need to have the format be flash, which it seems makes the point moot, because when I upload a flash form to my host, it won't show up (I've been testing all this on my local dev version).  I opened a support ticket on it, so we'll see.

                   

                   

                  -==cfSearching==- wrote:

                   

                  You should not need to look too far. IIRC CF8 supports cfinput type="datefield" which is html based (not flash like cfcalendar).

                  Oh my.  I think you may be my new best friend of all time.  For some reason, I always thought that only worked with flash format and not html.  It works PERFECTLY of course, even when I upload it and test it.

                   

                  I'll still need help in the future, mind you, because I'll still need to figure out a way to block off dates (holidays, days we'll be away on vacation, and dates that have already been booked).  But that's what I have all you people for!

                   

                  Since the class dates are all stored in a database, I guess it shouldn't be too hard to block dates off, although I'll probably have to do it on submit, so the customer submits the form, then it reloads with a message if that date is booked.  It would be nicer to highlight them in the calendar, but I'll take what I can get if the cfcalendar won't work.

                  • 6. Re: cfcalendar won't return selected value
                    Adam Cameron. Community Member

                    It would help if you posted some code that demonstrates what you're seeing, so we can try it too.  And/or check that there's nothing else idiosyncratic about it that make it behave in a way you're not expecting.

                     

                    --

                    Adam

                    • 7. Re: cfcalendar won't return selected value
                      Adam Cameron. Community Member

                      It's looking like I'm about to go snippet hunting for a javascript calendar, which is sort of what I was trying to avoid by using CF.

                       

                      It doesn't need to be a very long hunt.  JQuery has a plug-in which will do everything you need (and a bunch of stuff you won't need), and it's all pretty straight forward.

                       

                      I'd use the JQuery offering over the CF offering anyhow: I'd always use a JS/HTML solution over a Flash solution where possible (and all other considerations being equal).

                       

                      --

                      Adam

                      • 8. Re: cfcalendar won't return selected value
                        BreakawayPaul Community Member

                        Adam Cameron. wrote:

                         

                        It would help if you posted some code that demonstrates what you're seeing, so we can try it too.  And/or check that there's nothing else idiosyncratic about it that make it behave in a way you're not expecting.

                         

                        --

                        Adam

                        Good idea.  Here's what I've been using:

                         

                        <cfform id="reschedule" format="html" method="post" action="reschedule.cfm">
                        <cfcalendar 
                            name="schedule" 
                            required="yes" 
                            daynames="Su, M, T, W, Th, F, Sa"
                            monthnames="January, February, March, April, May, June, July, August, September, October, November, December"
                            width="250" 
                            height="200"
                            />--->
                        <cfinput type="submit" name="submit" class="submit" value="Submit" />
                        </cfform>
                        

                         

                        As far as the JQuery thing, I guess I'm not using that because I don't know the first thing about JQuery, LOL!

                        • 9. Re: cfcalendar won't return selected value
                          Adam Cameron. Community Member

                          I think you've found a bug.  Remove the ID attribute of the CFFORM tag, then it works.

                           

                          You should raise the bug here:

                          http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html

                           

                          Report back with the bug ref, so people know where it is, and can vote for it.

                           

                          Also: as a general rule, it's a bad idea to have a submit button with a name "submit".  It can collide with JS which leverages the submit() method of the form object.  It's nothing to do with your issue here, but just something to remember.

                           

                          As far as the JQuery thing, I guess I'm not using that because I don't know the first thing about JQuery, LOL!

                           

                          Same as everyone else before they started with it then.

                           

                           

                          --

                          Adam

                          • 10. Re: cfcalendar won't return selected value
                            BreakawayPaul Community Member

                            Thanks, submitted.

                             

                            It does seem to work now, locally, but it won't work on the server for some reason (I've emailed tech support).  It's shared hosting, and I'm occasionally finding things that don't work (like cfdump) so this may just be another one.

                             

                            I was using the ID attrib on the form tag because I'm knit-picky about HTML validation, and that seemed to solve a validation problem with my strict doctype.  In the end, I think it's more important that the form actually work than worry about a validation error.

                             

                            I do have a JQuery book from Sitepoint, which I plan to read soon.  I did try a JQuery plugin once before, but it didn't work at all, so I assumed there was some fundemental step to getting JQuery working in the first place that I was missing (like installing a library or something).  But I'll definitely need something more than the datapicker at some point, because I'll need to be able to block off dates that are unavailable.  Not to mention the datepicker seems to have a positioning problem in IE (ugh!)

                            • 11. Re: cfcalendar won't return selected value
                              -==cfSearching==- Community Member

                              I think you've found a bug.  Remove the ID attribute of

                              the CFFORM tag, then it works.

                               

                              Interesting. It also works if you give the cfform a "name" (CF9).

                              • 12. Re: cfcalendar won't return selected value
                                BreakawayPaul Community Member

                                -==cfSearching==- wrote:

                                 

                                Interesting. It also works if you give the cfform a "name" (CF9).

                                 

                                CF8 too.  In fact, if you have a name AND an id, it still works, but an id alone doesn't.

                                • 13. Re: cfcalendar won't return selected value
                                  -==cfSearching==- Community Member

                                  Hm... sounds like something internal requires a form "name" maybe? Post the bug # here when you, or Adam, have it.

                                   

                                  -Leigh

                                  • 14. Re: cfcalendar won't return selected value
                                    Adam Cameron. Community Member

                                    I can't even see the issue in the bug tracker.  What's the bug ID, BreakawayPaul?

                                     

                                    --

                                    Adam

                                    • 15. Re: cfcalendar won't return selected value
                                      BreakawayPaul Community Member

                                      Adam Cameron. wrote:

                                       

                                      I can't even see the issue in the bug tracker.  What's the bug ID, BreakawayPaul?

                                       

                                      --

                                      Adam

                                       

                                      I'm not sure actually. I submitted it, and it just said, "Your bug has been submitted for review" so I assumed that someone from Adobe would have to look at it and approve it, sort of like post moderation.

                                       

                                      btw Adam, I have the JQuery UI datepicker working perfectly, so thanks to everyone who suggested that route.  I've even gotten it to mark weekends, holidays, and vacations off, and figured out how to integrate some CF code to set the earliest available booking date.

                                      • 16. Re: cfcalendar won't return selected value
                                        Adam Cameron. Community Member

                                        btw Adam, I have the JQuery UI datepicker working perfectly, so thanks to everyone who suggested that route.  I've even gotten it to mark weekends, holidays, and vacations off, and figured out how to integrate some CF code to set the earliest available booking date.

                                         

                                        Yeah, JQuery has some good stuff, and is generally pretty well-written and easy to use.

                                         

                                        JQuery does a pretty good job at cross-browser compat, but always make sure to test all this stuff on all browsers you mean to support.  Sometimes there are idiosyncracies with older browsers (usually old IE versions, in my - limited - experience).

                                         

                                        --

                                        Adam