March 7th, 2012, 08:29 AM
Adding html, formatting or "includes" on application.cfm kills my grid. Please assist
I have a CFGRID that works fine if I put html on the page that the grid is on or if I use cfinclude on that page. If I put any html or "cfincludes" in my application.cfm page... it kills my grid and I get an "Exception thrown and not caught" error.
Does anyone have a suggestion on how I can address this? I'd like to put all of my formatting/includes in the application.cfm page so any other cfm pages created on my website automatically load these things.
March 7th, 2012, 08:43 AM
Sorry, I'm not sure what's going on. You can definitely have HTML or cfincludes in an Application.cfm file.
March 7th, 2012, 09:05 AM
Yes, it works fine with all other cold fusion stuff on my pages but it breaks my cfgrid. I believe this explains my issue but I am not having any luck with implementing it: http://forums.forta.com/messages.cfm?threadid=10C19539-E898-C4C8-5F32EBA5B054C3D6
Originally Posted by kiteless
March 7th, 2012, 09:15 AM
March 7th, 2012, 09:24 AM
I've certainly never heard of this, but without more information I can't really tell you what's going on because I have no idea what you're doing.
As an aside, most CF developers don't just throw a ton of output code in their Application.cfm/Application.cfc file. They use an MVC framework like FW/1 or Model-Glue that supports layouts and templates. It's probably been 10 years since I put output code in an Application.cfc. Keep in mind that if you put output code in an Application.cfm/cfc file, it will add that output to EVERY request, including AJAX requests. Same with debugging info appended to the end of a request. Either of which will obviously make any JSON or XML returned unusable.
March 7th, 2012, 09:27 AM
Yes, that is my issue and that is what is breaking my cfgrid. It is sending the formatting etc with my ajax requests. Do you have a recommendation on how I can accomplish the same type of thing as putting html in my application.cfm? I don't have control at the server level so all of my formatting etc has to be done on my "web" space. Am I forced to add includes to the .cfm page itself?
Originally Posted by kiteless
March 7th, 2012, 12:34 PM
Well like I said it's really been 10 or more years since I had to deal with this, long before AJAX. That said, one thing you might try is adding another Application.cfm file in the root directory of the CFCs you are binding to from your grid. Copy anything relevant from your main Application.cfm to this child Application.cfm. If you use cfapplication, make sure they use the same application name. But do not copy any layout code or layout includes. To be safe, wrap the whole file in cfsilent tags.
Since the CF server starts at the target folder and then works back up the folder hierarchy looking for an Applicaiton.cfm file to run, it should run your new one instead of the root one. Your child Application.cfm should have no output in it, especially if it is wrapped by cfsilent (which suppresses all output inside it).