Share Pastebin
Guest
Public paste!

Justin A.

By: a guest | Mar 12th, 2010 | Syntax: PHP | Size: 1.28 KB | Hits: 47 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <script type="text/javascript">
  7. function checkFields()
  8. {
  9.         var latData = document.dataSubmission.Latitude.value ;
  10.         var longData = document.dataSubmission.Longitude.value;
  11.         var dataForm = document.dataSubmission;
  12.         var errorRegion = document.getElementById('errorRegion');
  13.         //Could be any form of selection
  14.        
  15.         //Checks the form data to determine if its blank
  16.         if((latData == "") || (longData == ""))
  17.         {
  18.                
  19.                 errorRegion.style.visibility = "visible";
  20.                
  21.         }
  22.         else
  23.         {
  24.                
  25.                 errorRegion.style.visibility = "hidden";
  26.                 dataForm.submit();  //Allows us to submit data
  27.         }
  28. }
  29. </script>
  30.  
  31. </head>
  32.  
  33. <body>
  34.  
  35. <!-- An example of this form data!  -->
  36. <form name="dataSubmission" method="post" action="http://someurl.com>
  37.         Latitude<input type="text" name="Latitude"  /><br /><br />
  38.    Longitude<input type="text" name="Longitude"  />
  39.    <input type="button" value="Submit" name="Submit" onclick="checkFields()" />
  40. </form>
  41. <div id="errorRegion" style="visibility:hidden; width:300px; height:100px;">
  42. Error!</div>
  43.  
  44.  
  45. </body>
  46.  
  47.  
  48. </html>