CF "Enable Request Debugging Output" can break Dynamic XML

I have XML flash slideshows for a client's site that builds a dynamic XML which then is used in a .swf file

This morning, all I see are malformed XML Flash errors on my dev server's xml calls. across the board. everywhere. ARRGGH!

Flipping on Firebug, I see that the end of my XML files contains some CF debugging statements that should not be there. Turns out, the issue arose yesterday when I turned on CF Administrator's 'Enable Request Debugging Output' feature to get some feedback on some dynamic SQL statements being created.

With this feature turned on, the CF debug statements at the bottom of the page get sucked into the XML as part of the file generated. Very interesting indeed.

(disclaimer - of course you should _never_ have Request Debugging Output enabled on a production server :) )

Saving Form Variables as Session Variables the Wrong Way

A student approached me the other day. She were gathering search criteria in a form and wanted to save the criteria to a session variable. But when she moved from page to page, her session variable lost its values.

<cfif isdefined('form.submit')>
<cfset session.saveformvars = structnew()>
<cfset session.saveformvars = form>
</cfif>

The issue is with the the variable scoping that takes place on a form structure. Forms have a local "non-persistent" variable scope (they are only specific to that page, or the page called from the form and don't hang around).

Session variables are by nature persistent, or can exist beyond a single page, lasting for the user's session length.

When the entire form structure was saved as a session variable structure as above, that session structure received the same scoping as the form structure.

So...

<cfset session.saveformvars = form>
<!--- makes session.saveformvars now a local scoped variable and not a session scoped variable --->

Since this student wanted to only save those form fields that were had been completed and do some data tweaking on the information, I had her rewrite the snipped of code to loop through the form, pick out the variables to keep, then save those to the session variable.

<cfset session.plansearch = structnew()>
<cfloop collection="#form#" item='key'>
<!--- pick out null fields, and son't save the submit button or the "FieldNames" key from the form struct --->
<cfif form[key] neq '' and form[key] gt 0 and key neq 'fieldnames' and key neq 'submit'>
<cfset "session.plansearch.#key#" = form[key]>
</cfif>
</cfloop>

Now this student had her trimmed form list saved as a structure in the format she wanted.

Coldfusion 9 Hosting for Godaddy Dropouts Offered

Honey House Web Designs has dedicated servers offering Coldfusion 9 with MySQL 4, 5, or M$SQL databases to all customers who will be left stranded in November when GoDaddy shuts down it's hobbled CFMX7 (or earlier) hosting.

We will be offering a 10% discount to CF'ers who migrate to our hosting servers. Hosting is usually around $20/month (M$SQL is $10/month). Nightly backups, FTP, email, spam/spyware and all that other good stuff is included too.

Drop us an email at hhd at honeyhousedesigns.com. We'll even help you upgrade your CFMX7 to CF9 (like getting rid of third party CFIMAGE tags).

Happy New Year!

In 2011, I resolve to:

  • Keep crankin on CF9
  • Use jQuery more
  • Polish my ORM up more
  • Wear my fuzzy slippers more
  • Log more miles on my bicycle (2010 mileage was quite sad so this bar isn't very high)
  • Go to CFUnited, Max2010, Max 2011, Somewhere fun to network w/ colleagues

Honey House Web Designs wishes you and yours a very techy, geeky, terrific new year ;)

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact HHWD