spudly1987 Posted March 26, 2014 Share Posted March 26, 2014 Hey guys, need some minor assistance again. It should be simple i got some of the code working however confused on the rest. The concept I am trying to accomplish is that when they click on the "checkbox" to agree to the terms and then click on "continue to site" it will let them in, to which I do have that working properly. However, what I would like to have done is, if they don't click on the "checkbox" and try to click "continue to site" it will come up to a page saying "you have not agreed to terms" and i'm not sure If i have to create an additional page just for that line of text to call for that option. the third thing is yes this is a semi adult content site. so I'm not sure if it would be better to have it be where people would have to enter their birth day in as well on that page as a double verification if so wouldn't know where to start on that, but I would like to focus right now on the main issue. </title><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="practice.css" /> <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> <title>Untitled Document </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">You are about to enter a website that may contain content of an adult nature. These pages are designed for ADULTS ONLY and may include pictures and materials that some viewers may find offensive. If you are under the age of 18, if such material offends you, or if it is illegal to view such material in your community, please click away from this site now.</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> Quote Link to comment https://forums.phpfreaks.com/topic/287312-calling-on-a-button-to-perform-action/ Share on other sites More sharing options...
Skewled Posted April 12, 2014 Share Posted April 12, 2014 I would just disable the submit button until they check the box. $('#opt-in-checkbox').click(function(){ if($(this).attr('checked') == false){ $('#wpsp-continue').attr("disabled","disabled"); } else { $('#wpsp-continue').removeAttr('disabled'); } }); Feedback: I would have an age verification such as a birthday added to the form and server side checking because you can disable javascript. Quote Link to comment https://forums.phpfreaks.com/topic/287312-calling-on-a-button-to-perform-action/#findComment-1475851 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.