Guest_imported
New member
- Jan 1, 1970
- 0
Hello -
I've got a question about setting up a form with two submit buttons that do two different actions. If anyone could help, i would really appreciate it! Thanks in advance for any help you might be able to offer.
Here's the scenario:
I'm modifying an e-store which uses a shopping cart cgi. I don't know a whole lot about the CGI script and don't think modifying it makes sense for this problem. But, the way it is set up, the user goes through an entire page, choosing the amounts they would like of different items and then has to hit a submit button at the bottom to add the items to the cart. Here is the code for the submit button:
<input type=image name="add_to_cart" src="add_to_cart.gif" border=0>
Each item has a code which is used to generate the shopping cart information. The code for a particular item might be configured like this:
<input type=text size=2 name="id=1012LP|description=Railhed / Tarantella LP|price=8.00|shipping=LP|picture=thumbs/jt1012.gif">
However, these are records which can be bought in multiple formats (LP, CD, CD EP, etc). So, there are often 2 different formats, which I would like to allow the user to quickly add to their shopping cart by adding a "Buy One Now" button. These buttons can each be a submit button with the action add to cart, but the problem is that I have made hidden fields which set the value of each item to 1. So, if i hit submit it will enter the entire forma, therefore adding each item.
The old version of the site (minus this add one to cart function) can be viewed at
Here is an example of the new version that I am having problems with:
I have set a hidden field in the form with each of the formats' order code and the value set to 1. In other words, it is setting the value of the select field that is shown on the old version to 1 in advance for a quick "BUY ONE" feature. But, since there are two hidden fields, each set to a value of 1, pressing the submit key to "add_to_cart" adds one of each format to the shopping cart. I need to know how to fix it so that it only adds the format that the user chooses and either sets the value of the other hidden field to 0 or ignores that field completely. I can't get the field to set to 0 due to the strange name of the field, so i'm thinking something else might be possibl.
The easiest thing to do would be to have two different forms, each with their own submit button. However, this adds a space after the </FORM> tag and messes up the design. It is too tight to do it this way, unfortunately.
Does anyone have any advice about capturing the submit action and alter what gets added to the shopping cart? I've tried a bunch of different methods, but either that pesky unwanted format gets added to the shopping cart as well, or i have error problems.
Thanks!
Bill
I've got a question about setting up a form with two submit buttons that do two different actions. If anyone could help, i would really appreciate it! Thanks in advance for any help you might be able to offer.
Here's the scenario:
I'm modifying an e-store which uses a shopping cart cgi. I don't know a whole lot about the CGI script and don't think modifying it makes sense for this problem. But, the way it is set up, the user goes through an entire page, choosing the amounts they would like of different items and then has to hit a submit button at the bottom to add the items to the cart. Here is the code for the submit button:
<input type=image name="add_to_cart" src="add_to_cart.gif" border=0>
Each item has a code which is used to generate the shopping cart information. The code for a particular item might be configured like this:
<input type=text size=2 name="id=1012LP|description=Railhed / Tarantella LP|price=8.00|shipping=LP|picture=thumbs/jt1012.gif">
However, these are records which can be bought in multiple formats (LP, CD, CD EP, etc). So, there are often 2 different formats, which I would like to allow the user to quickly add to their shopping cart by adding a "Buy One Now" button. These buttons can each be a submit button with the action add to cart, but the problem is that I have made hidden fields which set the value of each item to 1. So, if i hit submit it will enter the entire forma, therefore adding each item.
The old version of the site (minus this add one to cart function) can be viewed at
Here is an example of the new version that I am having problems with:
I have set a hidden field in the form with each of the formats' order code and the value set to 1. In other words, it is setting the value of the select field that is shown on the old version to 1 in advance for a quick "BUY ONE" feature. But, since there are two hidden fields, each set to a value of 1, pressing the submit key to "add_to_cart" adds one of each format to the shopping cart. I need to know how to fix it so that it only adds the format that the user chooses and either sets the value of the other hidden field to 0 or ignores that field completely. I can't get the field to set to 0 due to the strange name of the field, so i'm thinking something else might be possibl.
The easiest thing to do would be to have two different forms, each with their own submit button. However, this adds a space after the </FORM> tag and messes up the design. It is too tight to do it this way, unfortunately.
Does anyone have any advice about capturing the submit action and alter what gets added to the shopping cart? I've tried a bunch of different methods, but either that pesky unwanted format gets added to the shopping cart as well, or i have error problems.
Thanks!
Bill