- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › [Solved] 2 javascript buttons with different scripts, but both buttons do the same thing…
I have 2 javascript buttons on my page.
1 adds to cart. –> “add to cart”
The other subscribes sends you a coupon. –> “receive instant coupon”
Yet, when I put the javascript for “receive instant coupon” into the product description area, next to the “add to cart” javascript button the “receive instant coupon” button does the action of the “add to cart” button.
So, when the try to enter their email and submit, they actually add the item to their cart…
http://turbodieselpower.com/cfm-intake-heater-delete-plug-99-5-03-ford-7-3l-23-002-000.html
Any advice/help is much appreciated.
Add a this.form.action=’….’ to your other submit button action.
Currently you have
//
var productAddToCartForm = new VarienForm('product_addtocart_form');
productAddToCartForm.submit = function(){
if (this.validator.validate()) {
this.form.submit();
}
}.bind(productAddToCartForm);
//]]>
and
//
var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
//]]>
// ]]>
hmmm…
Which one should I add it to? I added it to the below and was unsuccessful. I can not seem to find where the other js info is to modify…
I ended up hard coding this into one of the html files. It seems that when calling for that data in an XML update it caused the javascript to fall inside of a form. So that both functions were inside the form. Hard coding it was not pretty nor recommended, but it fixed the issue and we all know that is all it is about anyway.
Thanks for the help though!