www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 02-08-2007, 12:38 PM
    Jeney Jeney is offline
    Registered User
     
    Join Date: Feb 2007
    Posts: 4
    Exclamation Validation onSubmit?


    I am using DW MX2004 and MS Access. I have an insert form which works fine...HOWEVER, I want to make sure that users accepts the Terms & Conditions of our website before allowing them to post their inventoy. I have a checkbox on the form. If they check it then all is well and the insert will work as designed. IF they don't check it - I want an alert advising "You have choosen NOT to accept the Terms & Conditions of XXXX.com, so your inventory has NOT been posted." (obviously NOT update the dB) and take them back to our home page. I am new at this and trying to work it into the current code that DW writes. I can 'OnSubmit' call Javascript - but am lost at how to code it...have this so far...
    <script language="JavaScript" type="text/javascript">
    <!--
    function validate ()
    if (document.Update.Terms.Value == N)
    {
    alert ("You have choosen NOT to accept the Terms & Conditions of XXXX.com, so your inventory has NOT been posted.");
    }
    else
    {
    ?????????????????????//
    }
    -->
    THANKS for any and all help!!!
    Reply With Quote
      #2  
    Old 02-09-2007, 03:01 AM
    Fang's Avatar
    Fang Fang is offline
    Resistance is futile
     
    Join Date: Apr 2003
    Location: Netherlands
    Posts: 18,435
    Something like this:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title>Terms &amp; Conditions</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    <script type="text/javascript">
    function validate() {
    if (!document.Update.Terms.checked) {
    	alert ("You have choosen NOT to accept the Terms & Conditions of XXXX.com, so your inventory has NOT been posted.");
    	location.href="http://www.XXXX.com/"; // your homepage
            return false;
    	}
    }
    
    </script>
    
    </head>
    <body>
    <form action="processForm.cgi" name="Update" onsubmit="return validate();">
    	<fieldset><legend>Terms &amp; Conditions</legend>
    		<label for="Terms"><input type="checkbox" name="Terms" id="Terms">accept the Terms &amp; Conditions</label>
    		<button type="submit">submit</button>
    	</fieldset>
    </form>
    </body>
    </html>
    __________________
    At least 98% of internet users' DNA is identical to that of chimpanzees

    Last edited by Fang; 02-09-2007 at 03:04 AM.
    Reply With Quote
      #3  
    Old 02-09-2007, 09:50 AM
    Jeney Jeney is offline
    Registered User
     
    Join Date: Feb 2007
    Posts: 4
    Your Brilliant! Many, many thanks!
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:32 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.