5 Replies Latest reply on Dec 3, 2007 8:25 PM by emccormick

    Coldfusion.Navigate and IE7 error (Javascript)


      I have a page with one cfform containing one cfinput. When the user submits, Coldfusion.Navigate is called 3 times to update different sections of the page. Each has it's own .cfm called, it's own JS callback, and it's own cfdiv. I can get the correct data back in each section, but I always get this error in IE7: Error: 'document.getElementById(...)' is null or not an object...in reference to the JS callback function.

      In the callback function, I get good data back when looking for an element id that is anything other than the cfdiv id or a div id in the called .cfm page. If I ID the div at all in the called .cfm page, I get no data. If I reference the cfdiv ID in the callback, I get no data.

      I don't understand what's going on with the callback function. View source shows generated html div is named exactly as I name it in the cfdiv, yet if I look it up in the callback, nothing gets displayed.

      I hope you can see what I'm getting at.

      This code gives data back but IE7 errors:

        • 1. Re: Coldfusion.Navigate and IE7 error (Javascript)
          Your Code is missing the objects name between the quotation marks
          document.getElementById("").innerHTML = "";

          should be :

          document.getElementById("yourobject").innerHTML = "";
          • 2. Re: Coldfusion.Navigate and IE7 error (Javascript)
            emccormick Level 1
            Well, that's what I would have thought.

            Where 'yourobject' should go, I get a JS error but also the correct data back under the following conditions:

            1) with empty quotes as shown in the code attached before
            2) with any string between quotes

            Where 'yourobject' should go, I get no JS error but also no data back at all under the following conditions:

            1) with the cfdiv ID
            2) with an html div ID in the called .cfm in ColdFusion.Navigate

            What object should I be referencing in the callback function if neither the CFDIV ID nor the html div ID works?
            • 3. Re: Coldfusion.Navigate and IE7 error (Javascript)
              Level 7
              why do you even have that getElementById line in your function if it
              does not do anything? just get rid of it. have and empty js function for
              all your callbacks, if you need to keep the callbacks at all...

              Azadi Saryev
              • 4. Re: Coldfusion.Navigate and IE7 error (Javascript)
                Ronsweb Level 1
                The following code works.
                Here you go:

                I had to make a simple version. I am swamped today.

                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns=" http://www.w3.org/1999/xhtml">
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title>Untitled Document</title>

                <cfajaximport tags="cfinput-autosuggest,cfinput-datefield, cfajaxproxy, cfpod, cftooltip, cfdiv, cfwindow, cflayout-tab, cfform,cftextarea">
                <script language="javascript">
                var orgcallBack = function(){
                document.getElementById("orgsection").innerHTML = "This Works";
                var salescallBack = function(){
                document.getElementById("").innerHTML = "";
                var oppscallBack = function(){
                document.getElementById("").innerHTML = "";

                <!--- The error handler pops an alert with the error code and message. --->
                var myerrorhandler = function(errorCode,errorMessage){
                alert("[In Error Handler]" + "\n\n" + "Error Code: " + errorCode + "\n\n" + "Error Message: " + errorMessage);




                <cfform format="html" name="enterpartner" id="form1">
                <cfinput type="text"


                <cfinput type="button" name="Submit" value="Go!"
                onClick="javascript:ColdFusion.navigate('testcfdiv.cfm','orgsection',orgcallBack,myerrorh andler,'POST','form1');"


                <cfinput type="button" name="Print" value="Print" tabindex="2">
                <cfdiv id="orgsection"/>


                Hope this helps!

                • 5. Coldfusion.Navigate and IE7 error (Javascript)
                  emccormick Level 1
                  i don't see where ColdFusion.Navigate will succeed without a reference to the callback function. if there's a way to take that reference out, i haven't found it. however, the empty callback function works! no JS error, and the data gets into the div correctly.

                  thanks for your help all!