I cfparam both form and url forms of the variable.

Then I convert to Variables...

<cfparam name="form.something" default="" />
<cfparam name="url.something" default="" />

<cfset Variables.something = "myDefaultValue" />

<cfif len(url.something)><cfset Variables.something = url.something
/></cfif>
<cfif len(form.something)><cfset Variables.something = form.something
/></cfif>

Of course you can do other checking as well.  You may also notice that
because of the order I trust the form variables more than the url
variables.

One thing though, if the values are showing up in the url then your form
itself must be using GET, otherwise they wouldn't show in the URL.

Steve


-----Original Message-----
From: Claude Schneegans [mailto:schneeg...@internetique.com] 
Sent: Monday, September 14, 2009 3:05 PM
To: cf-talk
Subject: GET insread of POST: what would you do?


Hi,

 From time to time, I find in my error log errors due to undefined form 
variables.
The reason being that the template was requested using method GET 
instead of POST.

Of course, there are dumb bots that would GET any address they find in a

page,
but there are also true visitors, even registered members, who will 
eventually cause the same error.

I've also noticed that if you are in a page submitted from a FORM, you 
click on the address bar in the browser
and press Enter, then the same page will be requested with a GET, and 
cause the same error.

Then I intend to write some tag that will check the method used in the 
request,
but my question is: what would you do - or already do -  in case of GET 
instead of POST?
- send some error response?
- send the user back to the correct empty form?
- send some Javascript code to go back in the history?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326277
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to