Need help with agreement ticking box

  • legendrock7
  • Born
  • Born
  • legendrock7
  • Posts: 2

Post 3+ Months Ago

hi, i created a "agreement page" & it has a box where you have to click it & then click the button to continue.

here's my code:
Code: [ Select ]
<p>
<form action="" method="post">
<input type="checkbox" name="terms" value="accept" > <strong><font color="#ffffff">I have
read and agreed to these terms, and I am the owner of the paypal account and/or
credit card being used</font></strong>&nbsp;           <br><input onclick="window.location.href='####'" type="button" value="Continue to donate"

name="Tizenx_donate">
</form></p>
  1. <p>
  2. <form action="" method="post">
  3. <input type="checkbox" name="terms" value="accept" > <strong><font color="#ffffff">I have
  4. read and agreed to these terms, and I am the owner of the paypal account and/or
  5. credit card being used</font></strong>&nbsp;           <br><input onclick="window.location.href='####'" type="button" value="Continue to donate"
  6. name="Tizenx_donate">
  7. </form></p>


but you can click the button even if the box is there ( i know this is a html format *my code* so im guessing what i'm asking in, it's php required)

I NEED/want everyperson to click the box to be selected (checked) before clicking on the button to continue.


Example - Click on the box to be selected (checked) then you can proceed to click on the button to continue to the other page
if you're not getting it still

here's another example

Anyone can click on the button to continue on the other page, but i don't want that, i want the people to click on the button to be selected & then they can click on the button to continue on the other page.

please reply asap, i need this. Thanks!
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9099
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

On the server side you could use PHP to make sure that checkbox is actually selected, however you might want to use a combination of both PHP and JavaScript. The PHP side would just ensure they really did check that box, and on the JavaScript side you could do something so that the button is disabled or not visible until they check the box and then the JavaScript would make it so that the submit button appears.

Are you able to code anything in JavaScript or PHP? Are you familiar with jQuery?
  • legendrock7
  • Born
  • Born
  • legendrock7
  • Posts: 2

Post 3+ Months Ago

Bigwebmaster wrote:
On the server side you could use PHP to make sure that checkbox is actually selected, however you might want to use a combination of both PHP and JavaScript. The PHP side would just ensure they really did check that box, and on the JavaScript side you could do something so that the button is disabled or not visible until they check the box and then the JavaScript would make it so that the submit button appears.

Are you able to code anything in JavaScript or PHP? Are you familiar with jQuery?

i'm not, it would be great if you or somebody can help me.
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

This is something that was part of Web Design IV course i just did last semester, your going to need a validation form.

Code: [ Select ]
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function Validate(){
  if(!validateForm()){
    alert("Please Aggree to the Terms of Agreement to proceed.");
    return false;
  }
return true
}
function validateForm()
{
  var c=document.getElementsByTagName('input');
  for (var i = 0; i<c.length; i++){
    if (c[i].type=='checkbox')
    {
      if (c[i].checked){return true}
    }
  }
  return false;
}
</script>
</head>
<body>
<form name="myForm" action="takeagreement.php" onsubmit="return Validate()" method="post">
Value: <input type="checkbox" name="fname" value="value">
<input type="submit" value="Submit">
</form>
</body>
</html>
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script type="text/javascript">
  5. function Validate(){
  6.   if(!validateForm()){
  7.     alert("Please Aggree to the Terms of Agreement to proceed.");
  8.     return false;
  9.   }
  10. return true
  11. }
  12. function validateForm()
  13. {
  14.   var c=document.getElementsByTagName('input');
  15.   for (var i = 0; i<c.length; i++){
  16.     if (c[i].type=='checkbox')
  17.     {
  18.       if (c[i].checked){return true}
  19.     }
  20.   }
  21.   return false;
  22. }
  23. </script>
  24. </head>
  25. <body>
  26. <form name="myForm" action="takeagreement.php" onsubmit="return Validate()" method="post">
  27. Value: <input type="checkbox" name="fname" value="value">
  28. <input type="submit" value="Submit">
  29. </form>
  30. </body>
  31. </html>

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 63 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.