Well that is fine if you know PART of the
form.variable name as "var_" and that the
last part would ALWAYS be a number.
Use this case if you do not know at all
what the form.variables would be as well
as outputting the variable name on the page.
<cfoutput>
<cfif isdefined("form.fieldnames")>
<cfloop index="frmItem" list="#form.fieldnames#">
<!--- Use this to output all elements --->
FORM ELEMENT: #frmItem# <br>
FORM VALUE:
<cfif #Evaluate("form." & frmItem)# NEQ ''>
#Evaluate("form." & frmItem)#
</cfif>
</cfloop>
</cfif>
</cfoutput>
Might need to double check the syntax but did that
off the top of my head.
Randy Adkins
>>> [EMAIL PROTECTED] 05/17/02 12:10 PM >>>
Hopefully this is useful to some newbies (including myself). Lets
say Forms are dynamically created and named on a page..(ex.
Form.var_1, Form.var_2, etc.)
Lets also say that one of those forms is a checkbox or radio, and
they don't have to be checked or clicked...which means that the
variable won't exist, (unlike text fields, where the formfield
variable will exist even if left blank)
So in order to do something with the information passed to the next
page, you have to call it by its variable....but you might run into a
problem if that variable never existed in the first place. Secondly,
you don't know the name of that variable, since it was dynamically
created!
this is the basic way to check for it...
CFIF isdefined("form.var_"&index)
Let's say there are 4 form fields, but only 3 form variables were
passed. Form.var_1, form.var_2, and form.var_4
You would put that check inside a loop
CFLOOP index="index" from=1 to=4
CFIF isdefined("form.var_"&index)
DO and perform stuff
/CFIF
/CFLOOP
thats how ya do it. Although this might not seem like much, you can
created a new experience and different way to do things with your web
apps!
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists