add checkbox to button

Discussion in 'HTML & Website Design' started by nservices, Aug 4, 2009.

  1. #1
    Hi, i have the next code:
    PHP Code:
    <span id="review-buttons-container" class="a-center">
                <input type="image" src="<?php echo $this->getSkinUrl('images/btn_place_order.gif') ?>" onclick="review.save();" value="<?php echo $this->__('Place Order') ?>" />
            </span>
        </p>
    </div>
    <script type="text/javascript">
    //<![CDATA[
        var review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
    //]]>
    </script>
    PHP:
    and i add the follow JavaScript code to create checkbox (the idea is that only when you with the checkbox checked, the button work)

    i try:
    PHP Code:
            <span id="review-buttons-container" class="a-center">
            <form action="" onSubmit="return check(this);">
                <input name="chkbox" value="please make sure i'm checked" type="checkbox" />
                <input type="image" src="<?php echo $this->getSkinUrl('images/btn_place_order.gif') ?>" onclick="review.save();" value="<?php echo $this->__('Place Order') ?>" />
            </form>    
            </span>
        </p>
    </div>
    <script type="text/javascript">
    //<![CDATA[
    function check(form){
                    if( form.chkbox.checked )
                        return true;
                    else{
                        alert("please check the checkbox");
                        return false;
                    }
                }
                
                
        var review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
    //]]>
    </script>
    PHP:
    but its not work for me my javascript knowledge is not so good, please help me to create this checkbox) Thanks.
     
    nservices, Aug 4, 2009 IP