Re: Using two submit buttons to control form action
Thanx for all the feedback. I'm about 95% sure that I've done all this before and made it work. And the examples given have been tried too. There must be something different in my case. This simple use of 2 buttons on a page worked for me. But when I put it back into the live case it fails, so I think I am missing something there. I have trimmed out irrelevant code in an attempt to get this down to a basic test but still it fails showing me a string that has both button names (it didn't do this when I started with a single page). My case includes a cfwindow, so there are 2 bits of code below ... the page and the window. The calling page: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title script language=javascript function WinGo(WindowName,WindowCode) { ColdFusion.Window.show(WindowName); ColdFusion.navigate(WindowCode,WindowName); } /script/head body input name=Duration type=Button value=Change Duration onclick=WinGo('DurationWindowEdit','UpdateBookingChangeDuration.cfm?Guest=0')/ cfwindow closable=true draggable=true modal=true name=DurationWindowEdit resizable=false title=Change Duration width=500 height=200 x=100 y=100 headerStyle=font-size:13px; font-weight:bold; font-family:Verdana; background-color: ##003399; color: white; text-align:left; cfajaximport tags=cfform, cfwindow, cfdiv scriptsrc=/CFIDE/scripts /cfwindow !-- InstanceEndEditable -- /body /html and the window template: cfoutput !--- Postback processing if the form specified a change in partial stay duration --- cfif IsDefined(FORM.Choose) AND (FORM.Choose NEQ Full) cfdump var=#FORM# cfabort showerror=stop !--- Postback processing if the form specified a change to a full stay --- cfelseif IsDefined(FORM.choose) AND (FORM.choose EQ Full) cfabort showerror=made it cfelse!--- Initial call, just show the input form --- cfdump var=#FORM# cfform input name=Choose value=Change type=submit / input name=Choose value=Full type=submit / /cfform /cfif /cfoutput No matter what I do, it keeps setting FORM.Choose to Change,Full Any ideas? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333226 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Using two submit buttons to control form action
When I change the cfform to form, it works properly, but that will stop my cfinput and cfselect tags from working. Is it possible that there is something about the use of cfform that is causing this? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333231 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Using two submit buttons to control form action
...and so on. With HTML forms, if two or more form elements have the same name, the values of all active form elements with that name will be put into a comma-delimited list and show up in ColdFusion as a single variable with a list of values, as you experienced. This is great for checkboxes (getting a list of the ones that were checked that share a name), but not so great for submit buttons. Actually, it's great for submit buttons too! Only the one that is clicked will be sent to the action page. I've used this approach for many years, and I prefer it to giving the submit buttons different names. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsit ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333239 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Using two submit buttons to control form action
You will need to have a different name, and then check that value. Since your buttons both have the same name, the value for both will be in the form scope as you have seen. Again, that's not correct. You can certainly have submit buttons with the same name and different values. There are at least five types of form fields that don't pass their values to the action page in all cases: checkboxes, radio buttons, selected options in a select box, images, and submit buttons. I always just do a regular button, and change the form action via Javascript. That's not going to degrade very well if JavaScript is disabled. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333240 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Re: Using two submit buttons to control form action
When using a regular HTML form, we rely on the browser to act like a regular browser. Only the 'activated' elements of a form are sent. Form elements with the same name and are 'activated' will be received by the server as a comma-delimited list. In a regular form, only the button that is pressed is 'activated' so your scenario works correctly. Now enter into the world of cfwindow/cfform. These two tag-groups are extremely powerful, but do cause some changes in the way the form is processed. As you mentioned, when you changed your cfform to a regular form, it worked correctly, but you lost the 'keep in the cfwindow' functionality. Cfform and cfwindow appears to work together to submit forms via AJAX. The script probably compiles the form in the usual manner, any field with an active value are sent to the server. The ajax probably identifies the button that was pressed, by its name, and then gathers the values for that 'named field' In this case, you can achieve your needs in 1 of 2 ways (probably a lot more, but working on little sleep here). 1. make your buttons unique names, and parse on the server side based on the button that was pressed. 2. create an additional hidden field, when one of the buttons is pressed, pass the value of the pressed button to the hidden field using javascript, and have your server check the value of the hidden field, instead of the button. Hope this helps, William -- William E. Seiter On Apr 29, 2010, John Pullam jpul...@mcleansystems.com wrote: Thanx for all the feedback. I'm about 95% sure that I've done all this before and made it work. And the examples given have been tried too. There must be something different in my case. This simple use of 2 buttons on a page worked for me. But when I put it back into the live case it fails, so I think I am missing something there. I have trimmed out irrelevant code in an attempt to get this down to a basic test but still it fails showing me a string that has both button names (it didn't do this when I started with a single page). My case includes a cfwindow, so there are 2 bits of code below ... the page and the window. The calling page: ... ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333244 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Using two submit buttons to control form action
Then what I am reading is that ColdFusion simply doesn't do a correct job of processing cfform submit buttons when used in a cfwindow. As much as I would like to get it to run correctly I have opted for making this 2 separate small forms and then testing the existence of a button that is unique to each form in the postback processing. That was the cleanest thing to do in my case. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333270 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Using two submit buttons to control form action
I have seen several examples of using multiple form buttons on a single form. The idea is that you can get the value of the respective form variable when you are posted and then take the appropriate action. But I'm getting odd results. Instead of getting a single value, I get both values every time, and the examples I've seen suggest that you should only get the one that was pressed. Can anyone tell me what I'm doing wrong or what I need to do to get a single value? My code for the buttons is as follows: input name=Choose value=Change type=submit class=EditButton / input name=Choose value=Full type=submit class=EditButton / When I CFDump it, FORM.Choose is Change,Full ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333212 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Using two submit buttons to control form action
I'm using cf9 on iis7 and when I put what you've provided into a form, form.choose is either equal to change, or full, depending on which button was clicked. On Wed, Apr 28, 2010 at 6:24 PM, John Pullam jpul...@mcleansystems.comwrote: I have seen several examples of using multiple form buttons on a single form. The idea is that you can get the value of the respective form variable when you are posted and then take the appropriate action. But I'm getting odd results. Instead of getting a single value, I get both values every time, and the examples I've seen suggest that you should only get the one that was pressed. Can anyone tell me what I'm doing wrong or what I need to do to get a single value? My code for the buttons is as follows: input name=Choose value=Change type=submit class=EditButton / input name=Choose value=Full type=submit class=EditButton / When I CFDump it, FORM.Choose is Change,Full ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333213 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Using two submit buttons to control form action
I have seen several examples of using multiple form buttons on a single form. The idea is that you can get the value of the respective form variable when you are posted and then take the appropriate action. Usually that's triggered by the name of the form button that was clicked, not the value. For example, you might have two buttons: input type=submit name=btnSave value=Save input type=submit name=btnDelete value=Delete On your processing page... cfif isDefined(form.btnSave) !--- Save changes --- cfelseif isDefined(form.btnDelete) !--- Delete entry --- /cfif ...and so on. With HTML forms, if two or more form elements have the same name, the values of all active form elements with that name will be put into a comma-delimited list and show up in ColdFusion as a single variable with a list of values, as you experienced. This is great for checkboxes (getting a list of the ones that were checked that share a name), but not so great for submit buttons. -Justin ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333215 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Using two submit buttons to control form action
You're getting that result because both buttons have the same name. On Wed, Apr 28, 2010 at 5:24 PM, John Pullam jpul...@mcleansystems.com wrote: Can anyone tell me what I'm doing wrong or what I need to do to get a single value? My code for the buttons is as follows: input name=Choose value=Change type=submit class=EditButton / input name=Choose value=Full type=submit class=EditButton / When I CFDump it, FORM.Choose is Change,Full ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333214 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Using two submit buttons to control form action
You will need to have a different name, and then check that value. Since your buttons both have the same name, the value for both will be in the form scope as you have seen. I always just do a regular button, and change the form action via Javascript. Cheers, Rob On Wed, Apr 28, 2010 at 8:24 PM, John Pullam jpul...@mcleansystems.comwrote: I have seen several examples of using multiple form buttons on a single form. The idea is that you can get the value of the respective form variable when you are posted and then take the appropriate action. But I'm getting odd results. Instead of getting a single value, I get both values every time, and the examples I've seen suggest that you should only get the one that was pressed. Can anyone tell me what I'm doing wrong or what I need to do to get a single value? My code for the buttons is as follows: input name=Choose value=Change type=submit class=EditButton / input name=Choose value=Full type=submit class=EditButton / When I CFDump it, FORM.Choose is Change,Full ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333216 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: two SUBMIT buttons on a form?
Yeah the name of the button is in the form scope. -Shawn Regan -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:04 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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: two SUBMIT buttons on a form?
This won't work on IE 4.5 on the Mac, and NN 4.x (both Mac and PC) are giving me problems as I am testing this right now. Has anyone else had success with NN (or IE on the Mac) and naming buttons? Thoughts? -Original Message- From: Shawn Regan [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 7:26 AM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Yeah the name of the button is in the form scope. -Shawn Regan -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:04 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
You can change the action of your form with JavaScript. Not sure where I originally got the script. !--- Multiple Submit JavaScript This script will dynamically change the form action based upon which button is pressed. The form name must be specified and match the form name in the JavaScript. The submit buttons should be type=button and use an onclick=goSubmit('Pone'); for each of the elements. --- script function goSubmit(pg) { if (pg == Pone) { document.MyForm.action=index.cfm?fuseaction=action1 }else{ document.MyForm.action=index.cfm?fuseaction=action2 }document.MyForm.submit(); } /script form name=MyForm action=index.cfm method=post input type=button value=- Back onClick=goSubmit('Pone'); input type=button value=Finish onclick=goSubmit('Ptwo'); -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 9:40 AM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? This won't work on IE 4.5 on the Mac, and NN 4.x (both Mac and PC) are giving me problems as I am testing this right now. Has anyone else had success with NN (or IE on the Mac) and naming buttons? Thoughts? -Original Message- From: Shawn Regan [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 7:26 AM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Yeah the name of the button is in the form scope. -Shawn Regan -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:04 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
I do this... form action= method=post name=frm id=frm input type=button value='Copy' onclick=CopyButton() input type=button value='New' onclick=NewButton() /form script language=JavaScript1.2 function CopyButton() { document.frm.action = 'wherever.cfm'; document.frm.submit(); } function NewButton() { document.frm.action = 'wherever2.cfm'; document.frm.submit(); } /script Brian Yager President - North AL Cold Fusion Users Group Sr. Systems Analyst NCCIM/CIC [EMAIL PROTECTED] (256) 842-8342 -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 6:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
That is why I prefer the onClick to dynamically change the form action as you suggested. Shawn McKee -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 9:40 AM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? This won't work on IE 4.5 on the Mac, and NN 4.x (both Mac and PC) are giving me problems as I am testing this right now. Has anyone else had success with NN (or IE on the Mac) and naming buttons? Thoughts? -Original Message- From: Shawn Regan [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 7:26 AM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Yeah the name of the button is in the form scope. -Shawn Regan -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:04 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
I think the best solution is to learn fusebox. All of your buttons then go through an index page and then redirects the user accordingly. Not only is it very easy to have multiple submit buttons on a page it also organizes your code and helps make your application more modular. To find a good newbie guide on fb3 go to http://bombusbee.com/index.php?fuseaction=downloads.byCategory You can find info at www.halhelms.com or www.fusebox.org the only regret you'll have is not learning fb earlier. -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
Watch out though, the name of the button is only in the form scope if the button is pressed. If the form is submitted via the enter key (in IE), then the button was not pressed and the name of it will be undefined. Make sure you check for that, or include a hidden field with the same name. Yeah the name of the button is in the form scope. -Shawn Regan -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:04 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
Is the name of the button not showing up in the form scope on these browser version? -Shawn -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 7:40 AM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? This won't work on IE 4.5 on the Mac, and NN 4.x (both Mac and PC) are giving me problems as I am testing this right now. Has anyone else had success with NN (or IE on the Mac) and naming buttons? Thoughts? -Original Message- From: Shawn Regan [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 7:26 AM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Yeah the name of the button is in the form scope. -Shawn Regan -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:04 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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: two SUBMIT buttons on a form?
Ahh, ok thanks. -Shawn -Original Message- From: Tony Schreiber [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 7:57 AM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Watch out though, the name of the button is only in the form scope if the button is pressed. If the form is submitted via the enter key (in IE), then the button was not pressed and the name of it will be undefined. Make sure you check for that, or include a hidden field with the same name. Yeah the name of the button is in the form scope. -Shawn Regan -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:04 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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
two SUBMIT buttons on a form?
Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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: two SUBMIT buttons on a form?
you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
You could do this: html head script language=javascript !-- var formAction = null; function validForm(obj){ if (formAction == 1){ obj.action = action_page_1.cfm?variable=Anything; return true; } else if (formAction == 2){ obj.action = action_page_2.cfm?variable=SomethingElse; return true; } else { return false; } } //-- /script /head body .. form name=formName action=# method=post onsubmit=return validForm(this) input type=submit value=Action 1 onclick=formAction=1 input type=submit value=Action 2 onclick=formAction=2 /form .. /body /html HTH ^_^ -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ 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: two SUBMIT buttons on a form?
Yes -- Sam -Original Message- From: Scott Van Vliet [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:04 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? Does that work in Netscape? -Original Message- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 5:00 PM To: CF-Talk Subject: RE: two SUBMIT buttons on a form? you could set a name for you submit buttons. On you process page do a include based on which button was clicked. EX: form action=go.cfm input type=submit value=x1 name=click_x1 input type=submit value=x2 name=click_x2 /form -- go.cfm cfif isdefined(click_x1) cfinclude template=x1_process.cfm cfelseif isdefined(click_x2) cfinclude template=x2_process.cfm /cfif - -- Sam -Original Message- From: Ed Gordon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 4:54 PM To: CF-Talk Subject: two SUBMIT buttons on a form? Is there a simple way to have two buttons on the bottom of a form, one which goes to one .cfm and one to another, and yet have both process the entered form data on the way? I would of course label them differently, such as NEW and COPY, or for similar functions. TIA Ed Gordon 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 __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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