RE: [Spam?] Re: CFIF Not Working As Expected

2009-06-04 Thread Steve LaBadie

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

slaba...@po-box.esu.edu

-Original Message-
From: Peter Boughton [mailto:bought...@gmail.com] 
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


CFIF Not Working As Expected

2009-06-03 Thread Steve LaBadie

I have a form where a person can request to sign up for CMS access. This
person can also request access for a subordinate as well. I would like
the success page to confirm the person selection. If the primary person
is the only name, the name prints if the requester is registering for
someone else, both names print. Not sure which direction to go.

 

You have request CMS access for #form.name#

 

cfif IsDefined(form.name) AND form.name NEQ
cfoutputstrong#name#/strong/cfoutput

cfif form.requestname NEQ  AND form.name NEQ
cfoutput#form.requestname#/cfoutput

 

/cfif

/cfif

 

Steve LaBadie, Web Manager

East Stroudsburg University

200 Prospect St.

East Stroudsburg, Pa 18301

570-422-3999

http://www.esu.edu

slaba...@po-box.esu.edu

 



~|
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:323116
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFIF Not Working As Expected

2009-06-03 Thread Peter Boughton

Try this:

cfif StructKeyExists(Form,'Name') AND Len(trim(Form.Name))

cfoutputpYou have requested CMS access for /cfoutput

cfif StructKeyExists(Form,'RequestName') AND 
Len(trim(Form.RequestName))
cfoutputstrong#Form.Name#/strong and 
strong#Form.RequestName#/strong./p/cfoutput
cfelse
cfoutputstrong#Form.Name#/strong./p/cfoutput
/cfif

cfelse
!--- TODO: No name selected (validation error?) ---
/cfif


Hopefully all self-explanatory, but feel free to ask if any questions. 

~|
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:323118
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFIF Not Working As Expected

2009-06-03 Thread Steve LaBadie

Peter,

 

Why do you suggest using the StructKeyExists? Do you see a problem in
doing it this?

 

cfif form.name NEQ  AND form.requestname NEQ 

cfoutputstrong#form.requestname#/strong/cfoutput

cfelse

cfoutput#form.name#/cfoutput

/cfif

 

Steve LaBadie, Web Manager

East Stroudsburg University

200 Prospect St.

East Stroudsburg, Pa 18301

570-422-3999

http://www.esu.edu

slaba...@po-box.esu.edu

 

-Original Message-
From: Peter Boughton [mailto:bought...@gmail.com] 
Sent: Wednesday, June 03, 2009 2:00 PM
To: cf-talk
Subject: Re: CFIF Not Working As Expected

 

 

Try this:

 

cfif StructKeyExists(Form,'Name') AND Len(trim(Form.Name))

 

  cfoutputpYou have requested CMS access for /cfoutput

 

  cfif StructKeyExists(Form,'RequestName') AND
Len(trim(Form.RequestName))

cfoutputstrong#Form.Name#/strong and
strong#Form.RequestName#/strong./p/cfoutput

  cfelse

cfoutputstrong#Form.Name#/strong./p/cfoutput

  /cfif

 

cfelse

  !--- TODO: No name selected (validation error?) ---

/cfif

 

 

Hopefully all self-explanatory, but feel free to ask if any questions. 

 



~|
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:323125
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFIF Not Working As Expected

2009-06-03 Thread Peter Boughton

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:323133
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4