Re: finding dynamic form fields after submission
and this should hold true for the other three variables po_, role_ and year_ here's the loop again with the suggested changes For (i=1;i LTE Form.PE_Counter; i=i+1) if(StructKeyExists(FORM,'play_'&i)){ session.NODA09_formStruct['play_'&i] = form['play_'&i]; } if(StructKeyExists(FORM,'po_'&i)){ session.NODA09_formStruct['po_'&i] = form['po_'&i]; } if(StructKeyExists(FORM,'role_'&i)){ session.NODA09_formStruct['role_'&i] = form['role_'&i]; } if(StructKeyExists(FORM,'year_'&i)){ session.NODA09_formStruct['year_'&i] = form['year_'&i]; } it seems to stop after the first if statement, even when the key/value pair exists in FORM Matt Quackenbush wrote: > session.NODA09_formStruct['play_' & i] = form['play_' & i]; > > > On Sun, Dec 21, 2008 at 11:16 AM, Scott Stewart wrote: > > >>session.NODA09_formStruct.play_[i] = form[play_[i]]; >> >> > > > ~| 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:317044 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: finding dynamic form fields after submission
session.NODA09_formStruct['play_' & i] = form['play_' & i]; On Sun, Dec 21, 2008 at 11:16 AM, Scott Stewart wrote: >session.NODA09_formStruct.play_[i] = form[play_[i]]; > ~| 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:317043 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: finding dynamic form fields after submission
I tried this method, the looping *seems to be working* 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 } 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: > > > "">Then do something > > > On Fri, Dec 19, 2008 at 2:02 PM, Judah McAuley 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 >> 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: saste...@email.unc.edu >>> >>> >>> >>> >>> >> > > ~| 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
Re: finding dynamic form fields after submission
*sigh* where is the UnSend button? That tutorial only covers updating existing rows. Never mind :-) form.fieldnames and a little conditional logic should fix you right up. Don't forget to also exclude the form field(s) your submit button generates. -- -...@robertson-- Janitor, The Robertson Team mysecretbase.com ~| 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:317009 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: finding dynamic form fields after submission
That CFC is sweet! Ages ago I wrote up a complete tutorial on how to do the multi-record thing, start to finish. http://tutorial214.easycfm.com/ I used evaluate(), which is a sin, but otherwise its a pretty straightforward, basic way to get the job done. -- -...@robertson-- Janitor, The Robertson Team mysecretbase.com ~| 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:317007 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: finding dynamic form fields after submission
Scott, What is the widget called? Ravi. Scott Stewart 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. > ~| 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:317005 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: finding dynamic form fields after submission
dude. sweet! On Fri, Dec 19, 2008 at 12:51 PM, Brian Kotek wrote: > I wrote a CFC a while back that takes form field names that use array or > structure syntax and converts them into actual arrays and structures on the > CF side (to any arbitrary level of nesting). It's handy not only for > dynamic > fields (no more trying to parse user_1, user_2, etc.) but also for building > whatever collections of data you want (i.e. let it build up a user > structure > and pass that into your model rather than doing it manually, or passing the > whole form scope, etc.) > http://formutils.riaforge.org/index.cfm > > > http://www.briankotek.com/blog/index.cfm/2007/9/4/Implicit-Creation-of-Arrays-and-Structures-from-Form-Fields > > On Fri, Dec 19, 2008 at 3:09 PM, 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: > > > > > > > "">Then do something > > > > > > On Fri, Dec 19, 2008 at 2:02 PM, Judah McAuley > > 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 < > saste...@email.unc.edu> > > > 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: saste...@email.unc.edu > > > > > > > > > > > > > > > > > > > > > > > > > > > > ~| 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:317001 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: finding dynamic form fields after submission
I wrote a CFC a while back that takes form field names that use array or structure syntax and converts them into actual arrays and structures on the CF side (to any arbitrary level of nesting). It's handy not only for dynamic fields (no more trying to parse user_1, user_2, etc.) but also for building whatever collections of data you want (i.e. let it build up a user structure and pass that into your model rather than doing it manually, or passing the whole form scope, etc.) http://formutils.riaforge.org/index.cfm http://www.briankotek.com/blog/index.cfm/2007/9/4/Implicit-Creation-of-Arrays-and-Structures-from-Form-Fields On Fri, Dec 19, 2008 at 3:09 PM, 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: > > > "">Then do something > > > On Fri, Dec 19, 2008 at 2:02 PM, Judah McAuley > 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 > > 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: saste...@email.unc.edu > > > > > > > > > > > > > > > > > > ~| 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:317000 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: finding dynamic form fields after submission
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: Then do something On Fri, Dec 19, 2008 at 2:02 PM, Judah McAuley 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 > 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: saste...@email.unc.edu > > > > > > > > > > ~| 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:316998 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: finding dynamic form fields after submission
As well as the form.fieldNames sugested by Barney and Charlie. Since the form and url scopes are structures, as are all variable scopes in CF, you can use any of the structure functions or tags to parse the data. Such as: #structKeyList(form)# OR #structKeyList(url)# OR #form[field]# OR #url[field]# ~| 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:316997 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: finding dynamic form fields after submission
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 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: saste...@email.unc.edu > > > > ~| 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:316996 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: finding dynamic form fields after submission
Try this... #theField# = #form[theField]# -Original Message- From: Scott Stewart [mailto:saste...@email.unc.edu] Sent: Friday, December 19, 2008 2:57 PM To: cf-talk Subject: finding dynamic form fields after submission 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: saste...@email.unc.edu ~| 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:316995 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: finding dynamic form fields after submission
you can loop over the form.fieldnames value to get the list of fields. or as your form is dynamically generating the fields, update a hidden value with the # of current fields. on the action page, loop from 1 to the value of that hidden field and generate the names dynamically (e.g. form['po' & loopIndex]) On Fri, Dec 19, 2008 at 11:57 AM, Scott Stewart 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: saste...@email.unc.edu > > > > ~| 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:316994 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: finding dynamic form fields after submission
form.fieldnames lists all the submitted form fields. cheers, barneyb On Fri, Dec 19, 2008 at 11:57 AM, Scott Stewart 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: saste...@email.unc.edu > > > > ~| 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:316993 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
finding dynamic form fields after submission
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: saste...@email.unc.edu ~| 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:316992 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4