Peter,

 

I always use cfparam but I gather that also using the StructKeyExists is
more efficient. And yes agree I should be trimming as well and checking
that the submit button has been pushed.

 

Steve LaBadie, Web Manager

East Stroudsburg University

200 Prospect St.

East Stroudsburg, Pa 18301

570-422-3999

http://www.esu.edu

[email protected]

-----Original Message-----
From: Peter Boughton [mailto:[email protected]] 
Sent: Wednesday, June 03, 2009 5:30 PM
To: cf-talk
Subject: [Spam?] Re: CFIF Not Working As Expected

 

 

>Why do you suggest using the StructKeyExists?

 

Because it is the most efficient way to check if the Form scope contains
the Name field.

 

 

 

>Do you see a problem in doing it this?

> 

><cfif form.name NEQ "" AND form.requestname NEQ "">

>...

 

The main problem is that there is nothing to check/enforce that Name and
RequestName are defined.

You should use either StructKeyExists or cfparam to ensure you have
these fields, otherwise you will get an error when the page is accessed
directly.

 

Another issue that the validation can easily be bypassed with just a
space.

If you trim() the fields you ensure that you at least have some content
(even if you don't have full name validation).

 

 

 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:323155
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