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…

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #30073

    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…

    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()) {

    // var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
    // ]]>


    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!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.