I tried this method, the looping *seems to be working*
<cfscript>
For (i=1;i LTE Form.PE_Counter; i=i+1)
if(StructKeyExists(FORM,'play_#i#')and
Trim("Form.play_#i#") IS NOT ''){
session.NODA09_formStruct.play_[i] = form[play_[i]];
<----- error is in this line
}
</cfscript>
However this code throws the following..
You have attempted to dereference a scalar variable of type class
java.lang.String as a structure with members.
When I start playing around with the bracketing, it starts throwing CF
errors...
Aaron Rouse wrote:
> I always pass a hidden form element that is a counter filled in by JS for
> how many fields have been added. So if I have a field named foo_1 and I add
> foo_2, foo3, foo_4 and take away even foo_2 my hidden counter will pass in
> 4. then on the processing side I do a loop over my counter, something like:
>
> <cfloop from="1" to="#Form.Counter#" index="i">
> <cfif StructKeyExists(FORM, "foo_#i#") AND Trim(Form["Foo_#i#"]) IS NOT
> "">Then do something</cfif>
> </cfloop>
>
> On Fri, Dec 19, 2008 at 2:02 PM, Judah McAuley <[email protected]> wrote:
>
>
>> The way I do this is to have each form field have an underscore in it.
>> So play_1, play_2, etc
>>
>> Then I'd loop over the FORM collection and do a listfirst with _ as a
>> delimiter to figure out if I've got a play, a po, a role, etc or some
>> random field (like submit) that I don't care about. Then append the
>> value of form.play_1 to my playarray and move on to the next item in
>> the form collection.
>>
>> Judah
>>
>> On Fri, Dec 19, 2008 at 11:57 AM, Scott Stewart <[email protected]>
>> wrote:
>>
>>> Hey all,
>>>
>>> I have a form with one of those wonderful dynamic "ad form row" widgets.
>>> Because of this I never will know exactly what fields will be sent for
>>> processing...
>>>
>>> the original four fields in the row are called "play", "po", "role", and
>>> "year", the javascript generates "play1", "po1", "role1" and "year1" or
>>> 2, or 3 ad Infinitum based on how many rows the user has selected.
>>> on the processing side I need to write the form field values to a
>>> structure because there will be credit card processing before I write to
>>> the database.
>>>
>>> How can I loop over the form structure and find the dynamically
>>> generated form fields and their values.
>>>
>>> --
>>> Scott Stewart
>>> ColdFusion Developer
>>>
>>> Office of Research Information Systems
>>> Research & Economic Development
>>> University of North Carolina at Chapel Hill
>>>
>>> Phone:(919)843-2408
>>> Fax: (919)962-3600
>>> Email: [email protected]
>>>
>>>
>>>
>>>
>>>
>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317041
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4