House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

dynamic radio button submission

Author:
Tuan
04/14/2003 10:11 PM

I was able to get it to work using information you guys provided me.  I apologize for not responding earlier.  I've been busy at work.  Thanks again to all those who helped. maybe i am assuming this, but are you creating a list of items that need approve, decline, or open set to them? how about something like this for your form.... <cfoutput query="qItem"> <p>#qItem.Name# <input name="status_#qItemID#" type="radio" value="open" checked="checked">Open <input name="status_#qItemID#" type="radio" value="approved">Approved <input name="status_#qItemID#" type="radio" value="declined">Declined</p> </cfoutput> <input type="hidden" name="IDlst" value="#ValueList(qItem.ids)#"> <input type="submit"> than on your action page..... <cfloop list="#form.IDlst#" index="x">   <cfquery>   update blah set     status = <cfqueryparam value="#form['status_#x#']#">    where id = <cfqueryparam value="#x#">   </cfquery> </cfloop> i can't actually try that code out... but i have used the notation of form["foo_#x#"] manytimes and it works well hope that is what you are looking for jason --- "S. Isaac Dealey" <info@turnkey.to> wrote: > the x and form[x] variables are on the page following the form > submission. X > comes from the loop <cfloop index="x" list="approve,decline,open"> > which > means that on each iteration of the loop, x will be equal to > "approve", > "decline" or "open". Which means form[x] will be form.approve, > form.decline > or form.open. <cfif structkeyexists(form,x)> ensures that at least > one radio > button with the given name was selected on the previous page before > attempting the update. If so it should then update all of the items > for > which that radio button was selected with the given update > statement. > Actually I left out a queryparam -- it should say SET status = > <cfqueryparam > value="#x#" cfsqltype="cf_sql_varchar"> where id in etc... > > hth > > > I can't seem to get this to work.  I tried the code you > > provided below, > > but I can't get it to work.  Can you explain what the code > > is actually > > doing and where the #x#, and #form[x# came from. > > > Depends how the radio buttons are named... > > > <cfquery name="rs" ...> > > select * from blah > > </cfquery> > > > <cfoutput query="rs"> > >   <div nowrap> > >     #rs.id# #rs.name# > >     <input type="radio" name="approved" value="#rs.id#"> > >     <input type="radio" name="declined" value="#rs.id#"> > >     <input type="radio" name="open" value="#rs.id#"> > > </cfoutput> > > > next page > > > <cfloop index="x" list="approve,decline,open"> > >   <cfif structkeyexists(form,x)> > >     <cfquery ...> > >       UPDATE blah SET status = '#x#' WHERE id IN > >       <cfqueryparam value="#form[x]#" type="integer" > >       list="true"> > >     </cfquery> > >   </cfif> > > </cfloop> > > > >> How would i then create an insert query to insert these > >> dynamically created radio fields?  Like say the query > >> return 3 records so theres 3 rows of "NUM (some unique > >> #)", "NAME(some name)", approve(dynamically created > >> radio), disapprove(dynamically created radio) and > >> reopen(dynamically created radio).  How can I submit > >> those > >> fields to the database.  Can you please show me a SQL > >> insert statemat that would insert these dynamically named > >> radio inputs. > >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> ~ > >> ~~~~~~~~~~~| > >> Archives: > >> http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 > >> Subscription: > >> http://www.houseoffusion.com/cf_lists/index. > >> cfm?method=subscribe&forumid=4 > >> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq > >> 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 > > >>         Unsubscribe: > > http://www.houseoffusion.com/cf_lists/uns > >>         ubscribe.cfm?user=633.558.4 > > > > > s. isaac dealey                954-776-0046 > > > new epoch                      http://www.turnkey.to > > > lead architect, tapestry cms   http://products.turnkey.to > > > tapestry api is opensource     http://www.turnkey.to/tapi > > > certified advanced coldfusion 5 developer > > http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ~~~~~~~~~~~| > > Archives: > > http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 > > Subscription: http://www.houseoffusion.com/cf_lists/index. > > cfm?method=subscribe&forumid=4 > > FAQ: http://www.thenetprofits.co.uk/coldfusion/faq > > 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 > > >         Unsubscribe: http://www.houseoffusion.com/cf_lists/uns > >         ubscribe.cfm?user=633.558.4 > > > > s. isaac dealey                954-776-0046 > > new epoch                      http://www.turnkey.to > > lead architect, tapestry cms   http://products.turnkey.to > > tapestry api is opensource     http://www.turnkey.to/tapi > > certified advanced coldfusion 5 developer > http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 > >


Search cf-talk

May 22, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference