stephen.

to my knowledge there is a "form" scope of variables.

they are listed in a string (Comma separated) and can then
be sent to an array ListToArray(ListName) and from
there looped through, etc....


..tony

Tony Weeg
Senior Web Developer
Information System Design
Navtrak, Inc.
Fleet Management Solutions
www.navtrak.net
410.548.2337 


-----Original Message-----
From: Adams, Stephen [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 20, 2002 10:19 AM
To: CF-Talk
Subject: Referencing a dynamically named form field


**********************************************************************
WESTMINSTER CITY COUNCIL
Please refer to the disclaimer beneath this message
**********************************************************************

Hi,

I have created a form that is populated by a query, like this:


<form>
<cfoutput query="query">
        First Name: <input type="text" name="firstname"
value="#firstname#">
        Last Name: <input type="text" name="lastname"
value="#lastname#">
        <input type="radio" name="linkSection#CurrentRow#"
value="MyContent"
<cfif myLinks_section EQ "content">checked</cfif>
        <input type="radio" name="linkSection#CurrentRow#"
value="MyDepartment" <cfif myLinks_section EQ
"department">checked</cfif>>
        <input type="radio" name="linkSection#CurrentRow#"
value="MyWesminster" <cfif myLinks_section EQ
"westminster">checked</cfif>>

</cfoutput>
</form>

As you can see I have used an cfif statement to see which radio button
should be checked according to the queries results.  I have had to use
the
CurrentRow to give each set of checkboxes an individual name, so that
they
don't over write each other when selected.  This gives me a set of form
fields with names like linkSection1 and linkSection2, depending on how
many
results are returned by my query.

The problem I am having is referencing these checkboxes in my form
action
page.  I could just go <cfoutput>#FORM.linkSection1#</cfoutput> or
<cfoutput>#FORM.linkSection2#</cfoutput>, but the problems is I don't
know
how many there will be.  My query could return either 2 different
results or
50, that means I need to output either #FORM.linkSection1# to
#FORM.linkSection50#.  

My question is how can I call the form field no matter how many are
passed. 

I have tried this:

<cfloop index="index" from="1" to="#ListLen(FORM.firstname)#">
  <cfset FORM.linksSection = FORM.linksSection + #index#>
  <cfoutput>#FORM.linksSection#</cfoutput>
</cfloop>

but it failed.

Any one got any ideas?

Thanks

Stephen


**********************************************************************
Westminster City Council switchboard: 
+44 20 7641 6000
**********************************************************************
This E-Mail may contain information which is 
privileged, confidential and protected from 
disclosure.  If you are not the intended recipient 
of this E-mail or any part of it, please telephone 
Westminster City Council immediately on receipt.
You should not disclose the contents to any other 
person or take copies.
**********************************************************************


______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to