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!