SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2004
    Location
    USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Accept terms and conditions script

    Hi all,

    I found a script that will do this but I'm wondering if there is a way to modify it so that it makes the user confirm once more that they accept. Maybe have another alert that asks them:

    Please choose OK to accept the terms or Cancel to exit.

    Can this be added?

    Code:
    <SCRIPT language=JavaScript>
    <!--
    
    //Accept terms & conditions script (by InsightEye www.insighteye.com)
    //Visit JavaScript Kit (http://javascriptkit.com) for this script & more.
    
    function checkCheckBox(f){
    if (f.agree.checked == false )
    {
    alert('Please check the box to continue.');
    return false;
    }else
    return true;
    }
    //-->
    </SCRIPT>
    
    <form action="/yourscript.cgi-or-your-page.html" method="GET" onsubmit="return checkCheckBox(this)">
    
    <!--Enter your form contents here-->
    
    <b>By submitting, I agree that all info entered was done accurately & truthfully.</b><br>
    I accept: <input type="checkbox" value="0" name="agree">
    <input type="submit" value="Submit form">
    <input type="button" value="Exit" onclick="document.location.href='/index.html';">
    </form>

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Ash.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    <head>
    <title>untitled</title>
    <script type="text/javascript">
    
    function affirmData(oForm)
    {
    	var oCheckbox = oForm.elements.agree;
    	if (oCheckbox.checked)
    	{
    		var OK = confirm('Please confirm: all information entered is accurate.\n\nThank you.');
    		if (!OK)
    			return (oCheckbox.checked = false);
    	}
    	else
    	{
    		alert('Please check the "agreement" box to continue.');
    		oForm.elements.agree.focus();
    		return false;
    	}
    }
    
    </script>
    </head>
    <body>
    <form action="javascript&#58;alert('ok')" method="get" onsubmit="return affirmData(this)">
    
    <!--Enter your form contents here-->
    
    <b>By submitting, I affirm that all information entered is accurate & truthful.</b>
    <br /><br />
    You betcha. Agreed. <input type="checkbox" name="agree" value="1" />
    <br /><br />
    <input type="submit" value="Submit" />
    <input type="button" value="Exit" onclick="self.location='/index.html'" />
    </form>
    </body>
    </html>
    ::: certified wild guess :::

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2004
    Location
    USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Adios. This couldn't be more ideal, thanks!


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
  •