Sign up ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

My customer is wanting in Magento 1.9 for it to be required that the shipping estimate form on our site is filled out before checking out. To do this, we wanted to set the visibility option of the checkout button to none and then an action will make it visible. In this case for test purposes I have a simple test button.

The code I am using is:

<script type="text/javascript">


function checkoutwordsfunction()
{
document.getElementById('checkout').style.display="block";
document.getElementById('checkoutwords').style.display="none";
alert("Function Run");
}
</script>


<button type="button" id="checkout" style="display:none;" title="<?php echo $this->__('Proceed to Checkout') ?>" class="button btn-proceed-checkout btn-checkout"><span><span><?php echo $this->__('Proceed to Checkout') ?></span></span></button><br>
<span style="color:red;font-size:1.6em;" id="checkoutwords"><strong>You need to fill out Sales & Freight Charges box to continue checkout.</strong></span>

<button onclick="checkoutwordsfunction()">Button Test</button>

If I put this in a basic HTML page, the function changes the display of the objects and the alert box runs. When I put this into part of the Magento template, all together in one spot, I press the button and only the alert box pops up.

Any thoughts or help that can be provided would be appreciated.

Thanks!

share|improve this question

closed as too broad by Marius May 28 at 12:26

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
are there any Javascript errors in the browser's console? – JasonS Aug 11 '14 at 1:02
    
JasonS - Thanks for the reply. I looked at the browser's console and no errors popped up in it when I tried to run the script. I did see two errors that show up on all pages: Origin host.websitename.com not found in Access-Control-Allow-Origin header. and SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied. Could that be causing it? I am good with HTML but not a Javascript expert. Thanks! – webwise3 Aug 11 '14 at 5:49

Browse other questions tagged or ask your own question.