Looks to me like you're trying to handle form fields the same way you can in
PHP.  In PHP, giving a form name[1] makes it part of an array on the next
page.
However, ColdFusion will not handle form variables this way - instead of an
array called form.name, it would see a variable called form.name[1],
form.name[2], etc (which are invalid variable names).

Rather than trying to index your forms via arrays, try ColdFusion list
handling functions:

on your first page:

<form ...>
    <cfoutput query="something">
        <input type=hidden name=itemid value="#id#">
        <input type=hidden name=form.name value="#name#">
    </cfoutput>
</form>

this creates two lists, form.itemid and form.name - they will be in synch,
and can serve the same purpose as form element arrays in PHP:

<cfif listFind(form.itemid,getids.id)>

<cfoutput>#listGetAt(form.name,listFind(form.itemid,getids.id))#</cfoutput>
</cfif>



----- Original Message -----
From: "Bruce, Rodney (Contractor)" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, December 03, 2001 1:15 PM
Subject: Dynamic form fields


> hello all
>
> Hope you can help with a little problem.
>
> I have on a field that is named using an id.
>
> On the form I have:
> <CFQUERY name="getids">
> get ids
> </CFQUERY>
>
> <CFOUTPUT query="getids">
> <INPUT type="text" name="name[#getids.id#]" value="#getids.id#">
> </CFOUTPUT>
>
>
> On the action page I have:
> <CFQUERY name="getids">
> get ids
> </CFQUERY>
>
>
> <CFOUTPUT>
> #form.name[getids.id]#
> </CFOUTPUT>
>
> I get "error resolving parameter form.name.
> I can see all my form fields listed in the debugging info at bottom of
page.
> i.e.
> name[1] = 1
> name[2] = 2
>
> What am I missing?
>
> Thanks all
> Rodney
>
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.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