SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Terms and Conditions Verification

    Hi everyone! I need to have a terms & conditions verification setup. I have no idea how to go about doing this. I was told over in the PHP threads that this was a JavaScript question. My code is below. I basically need to have it to where there is a check box that says "I have read so and so, and agree to this and that...". This check box needs to be ticked in order for the visitor to be able to continue registration. Can I do this with the code below?

    Code:
          <tr>
           <td >
    
    <a href="../../index.php" title="Before you signup, please be sure to read this!"><input type=button value='Terms and Conditions'></a>
    
    	</td>
          </tr>
    Thanks for any feedback.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try putting this in your form:

    Code:
    <input type="checkbox" name="chkTCs" value="checkbox" />
    Then you can do a quick validate against the checkbox, I don't know PHP but you can do something simple like this:

    Code:
    <script type="text/javascript" lang="javascript">
    function valFrm() {
    if (document.forms['0'].chkTCs.checked = True);
    //checkbox is checked - submit the form
        { 
            submit()
        }
    }
    </script>
    Just call the "valFrm" function onClick of your forms submit button
    Help - I'm a noob!!

  3. #3
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    <html>
      <head>
        <script type="text/javascript">
          function checkConditions() {
            if(document.forms["conditionsAcceptForm"].conditionsAcceptCheckbox.checked)
              return true;
            if(!document.forms["conditionsAcceptForm"].conditionsAcceptCheckbox.checked) {
              alert("You have to accept the conditions");
              return false;
            }
          }
        </script>
      </head>
      <body>
        <form id="conditionsAcceptForm" action="http://www.google.com" method="post">
          <input type="checkbox" id="conditionsAcceptCheckbox">
          <input onclick="return(checkConditions())" type="submit" value="Submit">
        </form>
      </body>
    </html>
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!

  4. #4
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys/gals. I'll give that a try. Appreciate it much!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •