Jump to content

on button click to activate reject command


spudly1987

Recommended Posts

Okay guys, i have this code all set up and it seems to be working, however what is not working is when i don't click on the check box and then click on continue to website it still is continuing, how do i fix it so that when i don't check the box, and click on continue it follows through with the reject command

</head>
<div id="wpsp-container">
<!-- === Title === -->
<h1 id="wpsp-title"></h1>
<!-- === Text when a user reject the opt-in === -->
<div id="wpsp-reject">
You don't agree with the terms and conditions.
</div>
<div id="wpsp-text">
main text
</div>
<form method="post">
<input id="wpsp-nonce" type="hidden" value="2b5fd26d94" name="wpsp-nonce" /></input>
<input type="hidden" value="/" name="_wp_http_referer" /></input>
<!-- === Opt-In === -->
<span id="wpsp-opt-in">
<input id="opt-in-checkbox" type="checkbox" value="1" name="opt-in-checkbox"  /></input>
<label for="opt-in-checkbox">
I agree with the terms stated above.
</label>
</span>
<p>
<input id="wpsp-continue" type="submit" value="Continue to Web Site" formaction="index.html"  /></input>
</p>
</form>
</div>
<!-- === END #wpsp-container === --> 
</body>
</html>

I have made some changes to your code... I think this gets the desired effect:

 

Heres your code with some changes:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function enable(){
if(document.getElementById('opt-in-checkbox').checked = false){
document.getElementById('wpsp-continue').disabled = true;
}else{
document.getElementById('wpsp-continue').disabled = false;
document.getElementById('opt-in-checkbox').checked = true;
}
}
</script>
</head>
<div id="wpsp-container">
<h1 id="wpsp-title"></h1>
<div id="wpsp-reject">You don't agree with the terms and conditions.</div>
<div id="wpsp-text">main text</div>
<form method="post">
<span id="wpsp-opt-in">
<input id="opt-in-checkbox" type="checkbox" onclick="enable();" name="opt-in-checkbox"  /></input>
<label for="opt-in-checkbox">I agree with the terms stated above.</label>
</span>
<input id="wpsp-continue" type="submit" value="Continue to Web Site" formaction="index.html" disabled/></input>
</form>
</div>
</body>
</html>

it semi works the way i want it to , but it shows the "you don't agree with the terms and conditions" on the same page as the main text, also when i try to click on "continue to website" with out place a check mark and agreeing to terms, nothing happens 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.