Re: Dynamic form fields part two
If anyone is interested here is how I got this to work FINALLY!! cfoutput cfif isDefined(form.submit) cfloop index=i list=#Form.employeeID# cfif isDefined('form.reason#i#') AND #form[reason#i#]# NEQ cfquery datasource=alere INSERT INTO nonproductivetime ( employeeID, reason, time, addedby) VALUES ( #form[employeeID#i#]#, '#form[reason#i#]#', #form[time#i#]#, '#session.user.username#' ) /cfquery cfelse /cfif /cfloop /cfif /cfoutput On Fri, Jan 28, 2011 at 7:46 PM, Monique Boea moniqueb...@gmail.com wrote: Hello all. I have been trying to figure this out all day. Any assistance would be appreciated. I have a dynamic form that is in grid format: cfform name=enterNonProd action=#cgi.SCRIPT_NAME# method=post table class=content border=1 style=border-collapse:collapse; cellpadding=5 cellspacing=5 trtd colspan=3span class=titlenbsp;nbsp;Use the form below to enter non-productive time for agents. NOTE: Please enter time as minutes/span/td/tr tr td valign=top table class=content cellpadding=5 cellspacing=5 trtd colspan=3 height=10/td/tr trtdstrongAGENT/strong/tdtdstrongREASON CODE/strong/tdtdstrongMINUTES/strong/td/tr cfloop query=users cfif users.roleID NEQ 1 tr tdinput name=user#employeeID# type=checkbox value=#users.employeeID# #users.firstname# #users.lastname#/td td CFSELECT NAME=code#employeeID# OPTION value=/option OPTION value=PersonalPersonal/option OPTION value=Gone HomeGone Home/option /CFSELECT /td tdinput name=minutes#employeeID# value= size=5/td /tr /cfif /cfloop trtd colspan=3 height=20/td/tr trtd colspan=3 align=centerinput name=submit type=submit value=submit/td/tr /table /td /tr /table /cfform When the form is submitted, I need to be able to insert the variables in the db: I have the following code that I am able to get the values of the form vars with but I don't know where to go from here: cfoutput cfloop item=fname collection=#form# cfset response = evaluate(form.#fname#) cfif response NEQ AND response NEQ submit AND #fname# NEQ FIELDNAMES #fname# - #form[fname]# /cfif cfquery datasource=alere INSERT INTO nonproductivetime ( employeeID, code, minutes) VALUES ( cfqueryparam cfsqltype=CF_SQL_CHAR value=#form[fname]#, cfqueryparam cfsqltype=CF_SQL_CHAR value=#form[fname]#, cfqueryparam cfsqltype=CF_SQL_CHAR value=#form[fname]# ) /cfquery /cfloop /cfoutput ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341683 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Dynamic Form Fields to Populate An Array/Structure
Okay, Let me break this down a little. Here is what the form elements would look like after the categories were looped over (with just the category and the price fields): input type=checkbox name=category[0] value=1 checkedCompact Disc input size=6 type=text name=price[0] value=3.95br input type=checkbox name=category[1] value=2 checkedDVD-ROM input size=6 type=text name=price[1] value=9.95br input type=checkbox name=category[2] value=3Audio Cassette input size=6 type=text name=price[2] value= br input type=checkbox name=category[3] value=4Video Tape input size=6 type=text name=price[3] value=br How could I take this and make it a structure that I could pass to a component that would loop through the results and enter each record into the database? -Aaron On 2/2/06, Aaron Roberson [EMAIL PROTECTED] wrote: List, What I am attempting to do is display all available categories for a given product on an update page. The available category's fields, which include Title, Price, Special, Special Price, would be displayed in an editable input box. Then the values for each field, for each category, would be used to populate a structure that would be looped over again to be inserted into the database. How can I implement this conceptualization? ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231221 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic form fields calendars
Are you adding a table row? If so, the createElement method does not work for tablerows in IE. Look at for example: insertRow methods which have been described in the MSDN. Micha Schopman Project Manager Modern Media, Databankweg 12 M, 3821 AL Amersfoort Tel 033-4535377, Fax 033-4535388 KvK Amersfoort 39081679, Rabo 39.48.05.380 - Modern Media, Making You Interact Smarter. Onze oplossingen verbeteren de interactie met uw doelgroep. Wilt u meer omzet, lagere kosten of een beter service niveau? Voor meer informatie zie www.modernmedia.nl - -Original Message- From: Damien McKenna [mailto:[EMAIL PROTECTED] Sent: vrijdag 25 februari 2005 17:03 To: CF-Talk Subject: OT: Dynamic form fields calendars I'm working on a calendar project for work, as mentioned previously. I've been toying with JS CSS to do the event editor and the part I'm stuck on is how to dynamically add jscalendar buttons. IE just doesn't like me doing what I do, so I've been trying to get it working in Firefox first. In case you haven't used jscalendar before, you simply link in a few JS CSS files, add a text field (to store the date) and button (to launch the calendar popup) and the following JS: Calendar.setup( { inputField : 'date'+eventCount, ifFormat : %m%d%y, button : 'date'+eventCount+'_button' } ); The 'eventCount' part dynamically links to dynamically created text fields buttons named e.g. date1 and date1_button respectively. I've got a button that says add another date which creates a new date2 text field and date2_button button then runs the JS above with the new names. The problem is that after adding a new row only the new row's calendar button works, the others stop working. I thought it was because I had multiple calendars on the same page, but I have another (static) page that has three calendars on it, and they all work just fine. Any ideas what I should look for, or failing that, anyone have a suggestion on something else for me to try? Thanks. -- Damien McKenna - Web Developer - [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] The Limu Company - http://www.thelimucompany.com/ http://www.thelimucompany.com/ - 407-804-1014 #include stdjoke.h ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196550 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic form fields calendars
OK, I decided I'd try a different approach and am using code that pops open an entire window. Its working pretty good so far but I'm having to make many fixes changes to get it to do what I want. I'll see how it goes. -- Damien McKenna - Web Developer - [EMAIL PROTECTED] The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 #include stdjoke.h ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196573 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic form fields
try #evaluate('form.name[#getids.id#]')# -Original Message- From: Bruce, Rodney (Contractor) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 2:15 PM To: CF-Talk 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
RE: Dynamic form fields
I have on a field that is named using an id. ... CFOUTPUT query=getids INPUT type=text name=name[#getids.id#] value=#getids.id# /CFOUTPUT ... 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 When you submit a form, the fields within that form become ColdFusion variables. The characters [ and ], like all characters other than letters, numbers and underscores, aren't valid within variable names. If you want to work around this without changing your form field names (though, personally, I'd recommend changing your field names myself), you can probably just use the fact that the Form scope is a structure: #Form[name[1]]# I haven't tried this myself, though. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ~~ 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
Re: Dynamic form fields
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
RE: Dynamic form fields
First off, I don't know if CF willbe happy with form fields named with that syntax. I know PHP uses that syntax, but I can't promise it will work in CF... but... try it. :) Secondly, please, please, please do _not_ use Evaluate to get dynamic form fields. Remember that form fields are stored in a structure. You can rewrite #evaluate('form.name[#getids.id#]')# as: Form[name[#getids.ids#]] Not only will the code be quicker, it will also be much easier to read. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email: [EMAIL PROTECTED] Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Steven Dworman [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 3:11 PM To: CF-Talk Subject: RE: Dynamic form fields try #evaluate('form.name[#getids.id#]')# -Original Message- From: Bruce, Rodney (Contractor) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 2:15 PM To: CF-Talk 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 ~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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
RE: Dynamic form fields
you learn something everyday. thanks for the insight -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 3:17 PM To: CF-Talk Subject: RE: Dynamic form fields First off, I don't know if CF willbe happy with form fields named with that syntax. I know PHP uses that syntax, but I can't promise it will work in CF... but... try it. :) Secondly, please, please, please do _not_ use Evaluate to get dynamic form fields. Remember that form fields are stored in a structure. You can rewrite #evaluate('form.name[#getids.id#]')# as: Form[name[#getids.ids#]] Not only will the code be quicker, it will also be much easier to read. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email: [EMAIL PROTECTED] Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Steven Dworman [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 3:11 PM To: CF-Talk Subject: RE: Dynamic form fields try #evaluate('form.name[#getids.id#]')# -Original Message- From: Bruce, Rodney (Contractor) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 2:15 PM To: CF-Talk 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 ~~ Get the mailserver that powers this list at http://www.coolfusion.com 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
RE: Dynamic form fields
Thanks for all the suggestions. unfortunately I am not at my development server so can't test. but I am going to change the code to look like this. If you see anything that will not work please let me know. On the form: CFQUERY name=getids get ids /CFQUERY CFOUTPUT query=getids INPUT type=text name=name_#getids.id# value=#getids.id# /CFOUTPUT On the action page: CFQUERY name=getids get ids /CFQUERY CFOUTPUT form[name_#getids.id#] /CFOUTPUT again thanks for the help. -Original Message- From: Steven Dworman [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 1:37 PM To: CF-Talk Subject: RE: Dynamic form fields you learn something everyday. thanks for the insight -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 3:17 PM To: CF-Talk Subject: RE: Dynamic form fields First off, I don't know if CF willbe happy with form fields named with that syntax. I know PHP uses that syntax, but I can't promise it will work in CF... but... try it. :) Secondly, please, please, please do _not_ use Evaluate to get dynamic form fields. Remember that form fields are stored in a structure. You can rewrite #evaluate('form.name[#getids.id#]')# as: Form[name[#getids.ids#]] Not only will the code be quicker, it will also be much easier to read. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email: [EMAIL PROTECTED] Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Steven Dworman [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 3:11 PM To: CF-Talk Subject: RE: Dynamic form fields try #evaluate('form.name[#getids.id#]')# -Original Message- From: Bruce, Rodney (Contractor) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 2:15 PM To: CF-Talk 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 ~~ Get the mailserver that powers this list at http://www.coolfusion.com 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
RE: Dynamic form fields
Could I possibly get a copy too ? Much appreciated. Darren Adams Web Developer Marketing Department Systems Union Office: 01252 55 6220 Mobile: 07714 817 038 Email: [EMAIL PROTECTED] -Original Message- From: Derek Hamilton [mailto:[EMAIL PROTECTED]] Sent: 16 May 2001 05:36 To: CF-Talk Subject: Re: Dynamic form fields Cami, I use the FORM structure that ColdFusion creates automatically when using forms. This is a structure that you can test to see if the appropriate name/value pairs are there. If you want a better explanation I can email you a copy of a presentation I gave at my local CFUG about processing dynamic forms. HTH, Derek - Original Message - From: Cami Lawson [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, May 15, 2001 1:55 PM Subject: Dynamic form fields I have created a form and used names that are created dynamically based on the SQL. How can I reference these forms on a processing page? CFSET mybox = #acct#_#abbr# input type=checkbox name=#mybox# TIA, cami ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Dynamic form fields
Cami, I use the FORM structure that ColdFusion creates automatically when using forms. This is a structure that you can test to see if the appropriate name/value pairs are there. If you want a better explanation I can email you a copy of a presentation I gave at my local CFUG about processing dynamic forms. HTH, Derek - Original Message - From: Cami Lawson [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, May 15, 2001 1:55 PM Subject: Dynamic form fields I have created a form and used names that are created dynamically based on the SQL. How can I reference these forms on a processing page? CFSET mybox = #acct#_#abbr# input type=checkbox name=#mybox# TIA, cami ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Dynamic form fields
You can loop thru the fieldnames list that CF creates when a form is submitted. I can provide code if you need it. -- Original Message -- From: Cami Lawson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Tue, 15 May 2001 15:55:09 -0500 I have created a form and used names that are created dynamically based on the SQL. How can I reference these forms on a processing page? CFSET mybox = #acct#_#abbr# input type=checkbox name=#mybox# TIA, cami ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists