Connecting Tech Pros Worldwide Help | Site Map

<cfif isdefined is not working

Newbie
 
Join Date: Oct 2007
Posts: 1
#1: Oct 27 '07
I am using cold fusion 8 to develop forms. I need to check if user has entered a value of type "text". If not then a message has to Cfoutput. i am using the following code:

Expand|Select|Wrap|Line Numbers
  1. <cfif not isdefined("form.question")>
  2. <cfoutput> Enter question
  3. </cfoutput>
  4.  
  5. </cfif>
  6.  
The problem is even f nothing is entered in the Question Field, the message Enter question is not being displayed. Its as is the <cfif not isdefined("form.question")> is not at all being recognised.
I also tried <cfif not isdefined("form.question_now")>

Please help.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Oct 29 '07

re: <cfif isdefined is not working


Welcome to TSDN!

Try using cfparam and the default attribute instead. Then you can check for the default value (which you usually set to nothing - empty string).
Newbie
 
Join Date: Dec 2007
Posts: 5
#3: Dec 18 '07

re: <cfif isdefined is not working


Can you also post your form code?

coz I think <cfif not IsDefined("Form.whatever")> is fine, the problem
may point to the form submission. Check your form method, are you actually using post instead of get; you should also check which template you submit the form to??
Reply


Similar ColdFusion bytes