11 Replies Latest reply on May 19, 2015 2:20 AM by ViktorStamp

    CF9 - Page Generating Blank Code

    ViktorStamp

      Hi,

       

      I have been using coldfusion to generate pages on my server. However I have noticed that coldfusion seems to be generating the code below before the main code of the page. This seems to be affecting code trying to resolve compatibility mode issues in Internet Explorer, etc.

       

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

      <head>

      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

      </head>

       

      <body>

       

      </body>

      </html>

       

      Can anyone please advise if they know why this would be happening?

       

      Many thanks!

        • 1. Re: CF9 - Page Generating Blank Code
          BKBK Adobe Community Professional & MVP

          ColdFusion is not responsible for sending HTML content to the browser. That is the job of the web server.

           

          In any case, could you show us an example of your code?

          • 2. Re: CF9 - Page Generating Blank Code
            ViktorStamp Level 1

            So is this to do with the IIS on our server?

             

            The code is normal coldfusion code:

             

            <cfquery name="queryname" datasource="dsn">

            select field_name from table_name

            </cfquery>

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

            <head>

            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

            <title>...</title>...


            However, as mentioned, the empty code above appears before this when I view page source.

            • 3. Re: CF9 - Page Generating Blank Code
              BKBK Adobe Community Professional & MVP

              Under what name did you save the file?

              • 4. Re: CF9 - Page Generating Blank Code
                ViktorStamp Level 1

                This occurs regardless what the file name is (index.cfm, profile.cfm, etc).

                 

                What I have noticed that the code generated on a page where a cfform tag exists is as follows:

                 

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

                <head><script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>

                <script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>

                 

                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

                <script type="text/javascript">

                <!--

                    _CF_checkCFForm_1 = function(_CF_this)

                    {

                        //reset on submit

                        _CF_error_exists = false;

                        _CF_error_messages = new Array();

                        _CF_error_fields = new Object();

                        _CF_FirstErrorField = null;

                 

                 

                        //display error messages and return success

                        if( _CF_error_exists )

                        {

                            if( _CF_error_messages.length > 0 )

                            {

                                // show alert() message

                                _CF_onErrorAlert(_CF_error_messages);

                                // set focus to first form error, if the field supports js focus().

                                if( _CF_this[_CF_FirstErrorField].type == "text" )

                                { _CF_this[_CF_FirstErrorField].focus(); }

                 

                            }

                            return false;

                        }else {

                            return true;

                        }

                    }

                //-->

                </script>

                </head>

                 

                <body>

                 

                </body>

                </html>


                Hope this helps!

                • 5. Re: CF9 - Page Generating Blank Code
                  BKBK Adobe Community Professional & MVP

                  That is the intended functionality. The tag, cfform, instructs ColdFusion to apply its in-built capability to generate a form, together with the accompanying Javascript. If you don't want that, then you should use <form> instead.

                   

                  If you wish to obtain an ordinary page, it will be sufficient to do something like this:

                   

                  <cfquery name="queryname" datasource="dsn">

                  select field_name from table_name

                  </cfquery>


                  <cfdump var = "#queryname#">

                  • 6. Re: CF9 - Page Generating Blank Code
                    ViktorStamp Level 1

                    When having just the query and dumping the query as your suggestion, there is still an empty body tag generated before the query shows:

                     

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

                    <head>

                    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

                    </head>

                     

                    <body>

                     

                     

                     

                     

                    </body>

                    </html>

                    <style>

                     

                     

                        table.cfdump_wddx,

                        table.cfdump_xml,

                        table.cfdump_struct,

                        table.cfdump_varundefined,

                        table.cfdump_array,

                        table.cfdump_query,

                        table.cfdump_cfc,

                        table.cfdump_object,

                        table.cfdump_binary,

                        table.cfdump_udf,

                        table.cfdump_udfbody,

                        table.cfdump_udfarguments {

                            font-size: xx-small;

                            font-family: verdana, arial, helvetica, sans-serif;

                            cell-spacing: 2px;

                        }

                    ...

                    ...

                    • 7. Re: CF9 - Page Generating Blank Code
                      BKBK Adobe Community Professional & MVP

                      Then something is amiss. Try 2 things:

                       

                      1) Just to rule out, do an extended search of your code base to find out where you might be including the html tags.

                       

                      2) This might be a browser quirk, so try a different browser.

                      • 8. Re: CF9 - Page Generating Blank Code
                        ViktorStamp Level 1

                        I can't see anything that might include html in the code I'm using.

                         

                        This occurs on IE, Chrome and Firefox

                        • 9. Re: CF9 - Page Generating Blank Code
                          BKBK Adobe Community Professional & MVP

                          You might be having an unexplained error. Check the logs.

                          • 10. Re: CF9 - Page Generating Blank Code
                            BKBK Adobe Community Professional & MVP

                            Another suggestion, more or less a stab in the dark: implement the following method in your Application.cfc

                             

                            <cffunction name="onRequest">

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

                                   <cfsavecontent variable="pageContent">

                                      <cfinclude template="#arguments.targetPage#">

                                   </cfsavecontent>

                                   <cfif findNoCase("table.cfdump_wddx,", pageContent) gt 0>

                                    The string "table.cfdump_wddx," was found in the page, <cfoutput>#arguments.targetPage#</cfoutput><cfabort>

                                    </cfif>

                                </cffunction>

                            • 11. Re: CF9 - Page Generating Blank Code
                              ViktorStamp Level 1

                              Thanks again for your help. The function within the application file doesn't seem to be affecting anything.