27 Replies Latest reply: May 20, 2013 7:33 AM by JMLTO RSS

    CFDatefield not working in FF

    nonnybonny Community Member
      This has never happened to me: something actually works in IE and NOT in FF!

      Current version of FF is 3.06. The CFdatefield input does not function in any Mozilla-based browser and throws a Javascript error: Error: "_f is undefined"
      "Source File: http://localhost:8500/CFIDE/scripts/ajax/package/cfcalendar.js"

      This points to a line in the JS:

      "ColdFusion.Calendar.setUpCalendar=function(_6,_7,_8,_9,_a,_b,_c){
      var _d=ColdFusion.DOM.getElement(_6+_b+"_cf_button",_b);
      var _e=ColdFusion.DOM.getElement(_6,_b);
      var _f=null;
      var _10=null;
      if(_e.value!=""){
      _f=_e.value;
      _10=_f.split("/");
      }
      "
      Where the last two lines seem to have a problem.

      Can anyone help? This appears to be either a new issue (with a new release of FF maybe) or it's a local issue with my code (everything is possible I guess :).

      Robert


        • 1. Re: CFDatefield not working in FF
          The Limit

          Robert,

           

          Did you ever get an answer on this?  I'm having the same issue in both Firefox and IE 6.

           

          -Eric

          • 2. Re: CFDatefield not working in FF
            Stoney856 Community Member

            You need to add the name and id attributes to the cfform. That should work.

            • 3. Re: CFDatefield not working in FF
              MikeInAustin Community Member

              Same issue with a slight variation occurs in CF10.    This being updated code, it's a slightly different error:

              _10d=_10c.split("/");       Where 10c is undefined.

               

              Stoney856's answer reminded me of the need for an ID, but after adding that, it still didn't work.

               

              Turns out, I had two CFFORM's with the same ID on the page.   So the calendar gets confused as to what form element we're talking about.  So check for duplication of IDs on the page as well.

              • 4. Re: CFDatefield not working in FF
                DAYohn Community Member

                I am having a very similar issue, but the reverse - IE9 doesn't work, but IE8, FF, and Chrome all work fine.  The error:

                 

                SCRIPT5007: Unable to get value of the property 'split': object is null or undefined  -->  Line 43: _10d=_10c.split("/");

                 

                The field has both name and id, as does the CFFORM. (There is only one CFFORM on the page.)  I am event calling the CFAJAXIMPORT at the beginning of the file.

                 

                <cfajaximport  tags="cfform,cftextarea,CFINPUT-DATEFIELD">

                 

                <cfform

                name="registration" id="registration" method="post" action="#cgi.SCRIPT_NAME#">

                 

                Funny thing though, on the exact same code, but in another page, it works fine in all browsers.

                 

                <cfinput  type="datefield" name="udf_43" id="udf_43" class="editbody" style="width:255px;" validate="date" validateat="ONSUBMIT"

                required="yes" message="Required Field: Please enter the information for - BIRTHDATE.">

                 

                So, what is the fix?

                 

                • 5. Re: CFDatefield not working in FF
                  BKBK CommunityMVP

                  I tested the following code, which is equivalent to yours. It works as expected, no sweat.

                   

                  <cfajaximport  tags="cfform,cftextarea,CFINPUT-DATEFIELD">

                  <cfform name="registration" id="registration" method="post" action="#cgi.SCRIPT_NAME#">

                  <cfinput  type="datefield" name="udf_43" id="udf_43" class="editbody" style="width:255px;" validate="date" validateat="ONSUBMIT"

                  required="yes" message="Required Field: Please enter the information for - BIRTHDATE.">

                  <cfinput  type="submit" name="sbmt" value="send">

                  </cfform>

                  <cfif isdefined("form.udf_43")>

                  <cfdump var="#form#">

                  </cfif>

                   

                  My versions are:

                  ColdFusion: 10,0,3,283145

                  Internet Explorer: 9.0.8112

                   

                  It might help to update your IE 9 browser or ColdFusion build.

                  • 6. Re: CFDatefield not working in FF
                    BKBK CommunityMVP

                    I did another test. I let the submit input tag share the same id as the datefield, namely, udf_43. I then opened the page in Firefox(16.0.1), with Firebug switched on. The result was a Javascript error: "_10c is undefined". I suppose the moral is, make sure there are no duplicate IDs on the page.

                    • 7. Re: CFDatefield not working in FF
                      DAYohn Community Member

                      That is the strange thing, the exact same code works on one page, but not the other.  There are no duplicate IDs on the page, there is only one form on the page (with a unique ID).  The error is pulling from the cfcalendar.js when referenced from a single input type=datefield (as there is only one on the form).  Short of upgrading to CF10 (not currently in the budget), is there a way to troubleshoot an IE version 9 only issue?

                       

                      I am using CF Enterprise 9,0,1,274733 and IE 9.0.8112.

                      • 8. Re: CFDatefield not working in FF
                        BKBK CommunityMVP

                        I have copied the relevant script below. I expect it to be the same for both ColdFusion 9 and 10.

                         

                        ColdFusion.Calendar.setUpCalendar=function(_103,mask,_105,_106,_107,_108,_109){

                        var _10a=ColdFusion.DOM.getElement(_103+_108+"_cf_button",_108);

                        var _10b=ColdFusion.DOM.getElement(_103,_108);

                        var _10c=null;

                        var _10d=null;

                        if(_10b.value!=""){

                        _10c=_10b.value;

                        _10d=_10c.split("/");

                        }

                         

                        What the error message is saying is that the variable _10c can be null within the if-bracket. Peculiar.I am still looking into it.  

                        • 9. Re: CFDatefield not working in FF
                          BKBK CommunityMVP

                          DAYohn wrote:

                           

                          That is the strange thing, the exact same code works on one page, but not the other. 

                          I cannot reproduce the error. If the code works on one page, but not on another, have you compared the source of both pages?

                          • 10. Re: CFDatefield not working in FF
                            DAYohn Community Member

                            Hence my frustration.  I have compared code, I cannot find any differences.  It is down to something in IE9 only (can't believe IE8 works, but not IE9).  So back to the troubleshooting...

                            • 11. Re: CFDatefield not working in FF
                              BKBK CommunityMVP

                              I have reproduced the error every single time by also giving the submit button an ID of udf_43. That leads me to ask: (a) What happens when you change the ID to something else, say, dayohn_43? (b) What happens when you remove the id attribute from the datefield tag?

                              • 12. Re: CFDatefield not working in FF
                                DAYohn Community Member

                                Interesting idea.  1.  I removed the coded id.  When the page renders, the id is there anyway.  Still errors.  2.  Renamed the field - dayohn_43.  Still errors.  Here is a link to the form.

                                 

                                https://extapps.wvu.edu/registration/index.cfm?conf=9

                                • 13. Re: CFDatefield not working in FF
                                  BKBK CommunityMVP

                                  DAYohn wrote:

                                   

                                  Interesting idea.  1.  I removed the coded id.  When the page renders, the id is there anyway.  Still errors. 

                                  I feel we've almost cornered it. Now, a slight variation of the experiment. What happens when you test with the following code (I have changed the name attribute, too, because the built-in ColdFusion scripts may automatically generate an ID from the name)

                                   

                                  <cfform name="registration" id="registration" method="post" action="#cgi.SCRIPT_NAME#">

                                  <cfinput  type="datefield" name="dayohn_43" class="editbody" style="width:255px;" validate="date" validateat="ONSUBMIT"

                                  required="yes" message="Required Field: Please enter the information for - BIRTHDATE.">

                                  <cfinput  type="submit" name="sbmt" value="send">

                                  </cfform>

                                  <cfif isdefined("form.dayohn_43")>

                                  <cfdump var="#form#">

                                  </cfif>

                                  • 14. Re: CFDatefield not working in FF
                                    DAYohn Community Member

                                    I entered your code for the input directly and I still get the same error every time I click the calendar icon -


                                    Message: Unable to get value of the property 'split': object is null or undefined
                                    Line: 43
                                    Char: 1
                                    Code: 0
                                    URI: https://extapps.wvu.edu/CFIDE/scripts/ajax/package/cfcalendar.js

                                    • 15. Re: CFDatefield not working in FF
                                      BKBK CommunityMVP

                                      Please kindly leave the setting at name="dayohn_43" and send me the URL of the form. It will be just for an instant.

                                      • 16. Re: CFDatefield not working in FF
                                        BKBK CommunityMVP

                                        Ignore my previous post. I have looked into the matter some more. To be sure, this appears to be a browser/Javascript compatibility problem, not a ColdFusion problem.

                                         

                                        Apparently, it is well known that there are Javascript quirks in IE 9. The split() problem just happens to be one. One published workaound is to use the X-UA-Compatible metatag to get IE 9 to emulate IE8:

                                         

                                        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >

                                        • 17. Re: CFDatefield not working in FF
                                          DAYohn Community Member

                                          Added the X-UA-Compatible, with no change.  Here is the file.

                                           

                                           

                                          https://extapps.wvu.edu/registration/index.cfm?conf=9

                                          • 18. Re: CFDatefield not working in FF
                                            BKBK CommunityMVP

                                            Thanks. I have copied the page source.

                                            • 19. Re: CFDatefield not working in FF
                                              BKBK CommunityMVP

                                              Just a correction. I see on the web that a better version of the meta tag is

                                               

                                              <meta http-equiv="X-UA-Compatible" content="IE=8" >

                                              • 20. Re: CFDatefield not working in FF
                                                DAYohn Community Member

                                                Thanks.  Updated.  No Change.

                                                • 21. Re: CFDatefield not working in FF
                                                  BKBK CommunityMVP

                                                  What a puzzler! Following some more searching I see that the meta tag must be among the first within the head tag. So I thought of testing

                                                   

                                                  <cfhtmlhead  text='<meta http-equiv="X-UA-Compatible" content="IE=8">'>

                                                   

                                                  and

                                                   

                                                  <cfhtmlhead  text='<meta http-equiv="X-UA-Compatible" content="IE=7">'>

                                                  • 22. Re: CFDatefield not working in FF
                                                    BKBK CommunityMVP

                                                    The error disappears when I put the following line as the very first line in the head tag.

                                                     

                                                    <meta http-equiv="X-UA-Compatible" content="IE=8" />

                                                     

                                                    However, I have so far succeeded in doing that only in a static HTML copy of your page. If only there was a way to get Coldfusion to dynamically insert the meta tag as first tag in the head! That would be a neat workaround.

                                                     

                                                    I also discovered something absurd. The error disappears when I put the meta tag in onRequestStart, like this

                                                     

                                                    <cffunction name="onRequestStart">

                                                    <cfargument name = "targetPage" type="String" required="true">

                                                    <cfif listLast(arguments.targetPage,"/") is "calendarTest3.cfm">

                                                    <meta http-equiv="X-UA-Compatible" content="IE=8" />

                                                    </cfif>

                                                    </cffunction>

                                                     

                                                    However, though this works, it is messy. It places the meta tag at the very top of the page, even before the HTML doctype.

                                                    • 23. Re: CFDatefield not working in FF
                                                      DAYohn Community Member

                                                      Well...it works!  I added the

                                                       

                                                      <meta http-equiv="X-UA-Compatible" content="IE=8" /> prior to the doctype and it works.  It also doesn't change the behavior in any other browser, so thanks alot!

                                                      • 24. Re: CFDatefield not working in FF
                                                        BKBK CommunityMVP

                                                        Glad to hear. The workaround is kludgy. So I hope you have restricted it to the specific page(s).

                                                        • 25. Re: CFDatefield not working in FF
                                                          bmelendy Community Member

                                                          I'm running into this myself but only with Firefox 19, Chrome, IE and Safari all work correctly.  Also, it only fails on some screens, others work fine.  No duplicate forms or field names.  Can't figure this one out.  ColdFusion 9.01.  Nothing on this page has fixed my situation. 

                                                           

                                                          Error is " _293 is undefined" in cfcalendar.js line 43. 

                                                          • 26. Re: CFDatefield not working in FF
                                                            cwhitescoe Community Member

                                                            1. Check for a <p> tag without a closing </p> tag.

                                                            2. Open beer.

                                                            • 27. Re: CFDatefield not working in FF
                                                              JMLTO Community Member

                                                              I agree with cwhitescoe. But also check your other HTML tags. I had some bad code like this:

                                                               

                                                              <table>

                                                              <cfform>

                                                              <tr><td> FORM CODE </td></tr>

                                                              </table>

                                                              </cfform>

                                                               

                                                              The date picker icon would come up but woudn't show the actual date picker.

                                                               

                                                              When I corrected it, by moving the cfform tag above the table tag, it worked.