Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFDatefield not working in FF

New Here ,
Feb 13, 2009 Feb 13, 2009
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


9.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 23, 2009 Apr 23, 2009

Robert,

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

-Eric

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 21, 2010 Sep 21, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 07, 2012 Aug 07, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 19, 2012 Oct 19, 2012

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2012 Oct 25, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2012 Oct 25, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2012 Oct 25, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2012 Oct 25, 2012

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.  

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2012 Oct 26, 2012

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2012 Oct 26, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2012 Oct 26, 2012

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2012 Oct 26, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2012 Oct 26, 2012

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2012 Oct 26, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2012 Oct 26, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2012 Oct 26, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2012 Oct 26, 2012

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2012 Oct 26, 2012

Thanks. I have copied the page source.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2012 Oct 26, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2012 Oct 26, 2012

Thanks.  Updated.  No Change.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2012 Oct 27, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2012 Oct 27, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2012 Oct 28, 2012

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2012 Oct 28, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources