Skip navigation
Currently Being Moderated

CFDatefield not working in FF

Feb 13, 2009 3:09 AM

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


 
Replies
  • Currently Being Moderated
    Apr 23, 2009 10:14 AM   in reply to nonnybonny

    Robert,

     

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

     

    -Eric

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2010 11:49 AM   in reply to nonnybonny

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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 7, 2012 5:59 PM   in reply to nonnybonny

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2012 1:38 PM   in reply to nonnybonny

    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?

     

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2012 1:34 AM   in reply to DAYohn

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2012 1:50 AM   in reply to BKBK

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2012 4:55 AM   in reply to BKBK

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2012 6:42 AM   in reply to DAYohn

    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,_1 08,_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.  

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 2:44 AM   in reply to DAYohn

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 4:58 AM   in reply to BKBK

    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...

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 6:47 AM   in reply to DAYohn

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 7:24 AM   in reply to BKBK

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 7:49 AM   in reply to DAYohn

    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>

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 8:11 AM   in reply to BKBK

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 9:01 AM   in reply to DAYohn

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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 9:34 AM   in reply to DAYohn

    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" >

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 10:23 AM   in reply to BKBK

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

     

     

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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 11:27 AM   in reply to DAYohn

    Thanks. I have copied the page source.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 11:46 AM   in reply to BKBK

    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" >

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2012 11:48 AM   in reply to BKBK

    Thanks.  Updated.  No Change.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 27, 2012 8:22 AM   in reply to DAYohn

    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">'>

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 27, 2012 11:15 AM   in reply to BKBK

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 28, 2012 5:44 AM   in reply to BKBK

    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!

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 28, 2012 7:09 AM   in reply to DAYohn

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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 8, 2013 9:12 AM   in reply to nonnybonny

    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. 

     
    |
    Mark as:
  • Currently Being Moderated
    May 15, 2013 8:03 AM   in reply to nonnybonny

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

    2. Open beer.

     
    |
    Mark as:
  • Currently Being Moderated
    May 20, 2013 7:33 AM   in reply to cwhitescoe

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)