Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Location
    UK
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript to call warning message if box not ticked

    I am working on an ecommerce site using opencart.

    The original checkout page flags up a warning if you don't tick the terms and conditions box.

    Original checkout page (terms & conditions section):
    Code:
    <?php if ($error_warning) { ?>
    <div class="warning"><?php echo $error_warning; ?></div>
    <?php } ?>
    <?php if ($payment_methods) { ?>
    <p><?php echo $text_payment_method; ?></p>
    <table class="radio">
      <?php foreach ($payment_methods as $payment_method) { ?>
      <tr class="highlight">
        <td><?php if ($payment_method['code'] == $code || !$code) { ?>
          <?php $code = $payment_method['code']; ?>
          <input type="radio" name="payment_method" value="<?php echo $payment_method['code']; ?>" id="<?php echo $payment_method['code']; ?>" checked="checked" />
          <?php } else { ?>
          <input type="radio" name="payment_method" value="<?php echo $payment_method['code']; ?>" id="<?php echo $payment_method['code']; ?>" />
          <?php } ?></td>
        <td><label for="<?php echo $payment_method['code']; ?>"><?php echo $payment_method['title']; ?></label></td>
      </tr>
      <?php } ?>
    </table>
    <br />
    <?php } ?>
    <b><?php echo $text_comments; ?></b>
    <textarea name="comment" rows="8" style="width: 98%;"><?php echo $comment; ?></textarea>
    <br />
    <br />
    <?php if ($text_agree) { ?>
    <div class="buttons">
      <div class="right"><?php echo $text_agree; ?>
        <?php if ($agree) { ?>
        <input type="checkbox" name="agree" value="1" checked="checked" />
        <?php } else { ?>
        <input type="checkbox" name="agree" value="1" />
        <?php } ?>
        <input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button" />
      </div>
    </div>
    <?php } else { ?>
    <div class="buttons">
      <div class="right">
        <input type="button" value="<?php echo $button_continue; ?>" id="button-payment-method" class="button" />
      </div>
    </div>
    <?php } ?>
    <script type="text/javascript"><!--
    $('.colorbox').colorbox({
    	width: 560,
    	height: 560
    });
    //--></script>
    I recently bought a different checkout module (ubercart) which compacts the checkout process.

    The deafult setting of ubercart only shows the payment method when you click the terms and conditions. I didn't like this I have set it so the payment method is always shown however, I now need to call an error if the terms and conditions box isn't ticked.

    Ubercart checkout page (terms & conditions section):
    Code:
          <!-- Agree -->
          <?php if ($text_agree) { ?>
    	  <div class="buttons agree">
    		<div class="right" style="width:100%"><?php echo $text_agree; ?>
    		  <?php if ($agree) { ?>
    		  <input type="checkbox" name="agree" value="1" checked="checked" />
    		  <?php } else { ?>
    		  <input type="checkbox" name="agree" value="1" />
    		  <?php } ?>
    		</div>
          </div>
          <?php } ?>
          <!-- Agree -->
    
    
          <!-- Payment -->
          <div class="content" id="payment_div"<?php echo $payment; ?></div>
          <!-- Payment -->
    If anyone could help it would be much appreciated.

  • #2
    New Coder
    Join Date
    Oct 2009
    Posts
    61
    Thanks
    2
    Thanked 1 Time in 1 Post
    This is a PHP / server side issue, your original code didn't use javascript to alert anything

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Location
    UK
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Sing View Post
    This is a PHP / server side issue, your original code didn't use javascript to alert anything
    Thanks for your reply.

    I should have posted the entire original checkout page. It is too long to post so I have attached it.
    Attached Files Attached Files


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •