spudly1987 Posted February 18, 2014 Share Posted February 18, 2014 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> Link to comment https://forums.phpfreaks.com/topic/286295-on-button-click-to-activate-reject-command/ Share on other sites More sharing options...
josh1600 Posted February 19, 2014 Share Posted February 19, 2014 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> Link to comment https://forums.phpfreaks.com/topic/286295-on-button-click-to-activate-reject-command/#findComment-1469508 Share on other sites More sharing options...
spudly1987 Posted February 19, 2014 Author Share Posted February 19, 2014 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 Link to comment https://forums.phpfreaks.com/topic/286295-on-button-click-to-activate-reject-command/#findComment-1469515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.