Jump to content

So.... A simple check box


camdav72
 Share

Recommended Posts

I am needing to include a check box at the bottom of my payment form to be sure that users have read my terms and conditions. I have seen it hundreds of times on various websites. The user cannot complete sale unless they check the box. Is this an easy thing to code? Thanks in advance guys Cammie

Link to comment
Share on other sites

Ok, I am kinda new to DW and HTML so please bear with me here... I get the whole code part for checking the box but how do I prevent the user from proceeding from page without checking it. I want them to click box to accept terms before they can proceed and click 'purchase'...

Link to comment
Share on other sites

<form onsubmit="return check();"> rest of inputs..<input type="checkbox" id="check1" name="check1" /><input type="submit" value="submit"></form>

function check() {var valid = true;tc_check = document.getElementById("check1"); if(tc_check.checked!=true){alert("Oops you forgot the T and C")valid = false}return valid;}

the onsubmit="return check();" in the form element calls the check function and waits for returned true or false response, if true submit the form, else do not.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...