David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler

    Web app developer since 1994 and former Developer Advocate with Google now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 241 other followers

  • Sleepless Nights…

    August 2004
    S M T W T F S
        Nov »
  • Blog Stats

    • 929,366 hits

Missing CFOUTPUT causes double submit

Posted by David Chandler on August 5, 2004

Recently, I came across a bizarre bug in which a page was being called twice as a result of a single click on a SUBMIT button.

The following code was the culprit:

<LINK REL=STYLESHEET TYPE=”text/css” HREF= “#variables.dir#/style.htm”>

How can a style sheet cause a double request? Well, note the absence of a CFOUTPUT. The href path begins with a pound, which is the HTML “bookmark” character that means look for a given page and scroll to a position. In the absence of a specified page (somewhere.cfm##bookmark), the browser looks for the bookmark in the current URL, so it made a GET request to the same URL it had just POSTed. Since none of the FORM values were present in the GET request, CF encountered an error, but because it was in response to a style sheet include, the error message never appeared on the page.

Make sure your HREFs with # signs are inside a CFOUTPUT block.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: