Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 996957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:57:24+00:00 2026-05-16T06:57:24+00:00

On a Magento shopping cart, there are 2 forms that need to be filled

  • 0

On a Magento shopping cart, there are 2 forms that need to be filled out: shipping estimate and coupon code. Each refreshes the page after submitting the form. The shipping estimate form needs to be submitted before the coupon form so that the coupon can validate the country.

What I’d like to do is to call the shipping form’s coShippingMethodForm.submit() on load. That way the country is loaded, and then the coupon form will check the country. This has the added advantage that the initial shipping rates are displayed without requiring the user to submit the form.

My challenge: if I call coShippingMethodForm.submit() on load – it will refresh the page and then continuously refresh b/c the coShippingMethodForm.submit() keeps submitting and refreshing.

How do I call that function once, page refreshes, and not run again (unless the user clicks the submit button).

Example Magento cart page I’m referring to

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:57:24+00:00Added an answer on May 16, 2026 at 6:57 am

    You can use cookie to prevent resumbit on reload.
    Function js for broswer cookie can be found here http://www.quirksmode.org/js/cookies.html
    In your JS function coShippingMethodForm.submit

    coShippingMethodForm.submit = function(){
         //check cookie here
         if(readCookie('already_submit')==1)
              return;
         createCookie('already_submit', 1, 1); //for 1 day
         //old code here
    }
    

    And on submit button, add eraseCookie line:

    <input type="submit" id="your_submit_button" 
           onclick="eraseCookie('already_submit');" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My magento install has a free shipping shopping cart rule, as well as coupon
Is there a known way to create a new coupon code (Shopping Cart Price
I need to extend the Magento shopping cart to include an extra step for
In Magento, if you need to get / fetch the Shopping Cart's Item details,
A client has asked me to reduce the complexity of Magento's …/template/checkout/cart/shipping.phtml so that
I use Paypal Payments Advanced for my Magento shopping cart. I found out a
What's the easiest way to pre-fill a shopping cart in Magento? There is the
i want to look at the code in magento where the shopping cart rules
I need to read the condition of a shopping cart price rule in magento
How can I set the shipping cost for Magento for all baskets that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.