Help with validation

  • bido
  • Newbie
  • Newbie
  • bido
  • Posts: 6

Post 3+ Months Ago

I can't validate my page. Please someone help me if you can.
Code: [ Select ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "---/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="....org/1999/xhtml">
<head>

<script type="text/javascript">
<!--
//-->

function checkform ( form )
{

 if (form.occupation.value == "") {
  alert( "Please enter your occupation." );
  form.occupation.focus();
  return false ;
 }
 return true ;
}


function checkform(f) {
 for (var i=0; i<f.elements("gender").length;
  i++) {
  var radio = f.elements("gender")[i];
  if (radio.checked) {
   return true;
  }
 }
 // no checked radio button found
 window.alert("Choose your gender!");
 f.elements("gender")[0].focus();
 return false;
}

function checkform(f) {
 for (var i=0; i<f.elements("job").length;
  i++) {
  var radio = f.elements("job")[i];
  if (radio.checked) {
   return true;
  }
 }
 // no checked radio button found
 window.alert("Choose if you have a job!");
 f.elements("job")[0].focus();
 return false;
}

function checkform(f) {
 for (var i=0; i<f.elements("bla").length;
  i++) {
  var radio = f.elements("bla")[i];
  if (radio.checked) {
   return true;
  }
 }
 // no checked radio button found
 window.alert("Answer question number 1");
 f.elements("bla")[0].focus();
 return false;
}

function checkform(f) {
 for (var i=0; i<f.elements("use").length;
  i++) {
  var radio = f.elements("use")[i];
  if (radio.checked) {
   return true;
  }
 }
 // no checked radio button found
 window.alert("Answer question number 3!");
 f.elements("use")[0].focus();
 return false;
}

function checkform(f) {
 for (var i=0; i<f.elements("often").length;
  i++) {
  var radio = f.elements("often")[i];
  if (radio.checked) {
   return true;
  }
 }
 // no checked radio button found
 window.alert("Answer question number 5!");
 f.elements("often")[0].focus();
 return false;
}

function checkform(f) {
 for (var i=0; i<f.elements("upload").length;
  i++) {
  var radio = f.elements("upload")[i];
  if (radio.checked) {
   return true;
  }
 }
 // no checked radio button found
 window.alert("Answer question number 6!");
 f.elements("upload")[0].focus();
 return false;
}

</script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Questionaire</title>
<link href="oneColLiqCtrHdr19.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
body {
    background-color: #FFF;
    background-image: url(images/aa.jpg);
}
-->
</style></head>

<body class="oneColLiqCtrHdr">
<div id="container">
<div id="header">
  <h1>&nbsp;</h1></div>
  
  <p>
   <!-- forms -->
   
   
   
 <form action="...../interaction/saveforminfo.aspx" method="post" onsubmit="return checkform(this);">
   
 <input type="hidden" name="surveyid" value="knjuku2" />
 <input type="hidden" name="usecookie" value="true" />
 <input type="hidden" name="landingpage" value="http.../thanks.html" /> 
 
 <!--.../interaction/viewdb.aspx?surveyid=knjuku2-->
<p align="center"><b>This survey was made for Business Academy Copenhagen North project not for FDIM.</b></p>
  <p>
<fieldset>
<div align="center">
 <b>Please enter your personal information</b>
</div>

<p align="center"><b>Your Occupation:</b>
 <input type="text" name="occupation" /><br /></p>
<p align="center">
 <b>Age Group:</b> <select name="age">
  <option value="under 18">less then 18</option>
  <option value="18-25">18-25</option>
  <option value="26-35">26-35</option>
  <option value="over 35">more then 35</option>
  </select></p>
<p align="center">
 <b>Status:</b> <select name="status">
 <option value="single">Single</option>
 <option value="single with children">Single with children</option>
 <option value="in relationship">In relationship</option>
 <option value="married">Married</option>
 <option value="divorced">Divorced</option>
 </select></p>
 <p align="center"><b>Gender:</b>
 <input type="radio" name="gender" value="male" /> Male
 <input type="radio" name="gender" value="female" /> Female<br /></p>
 
 <p align="center">
  <b>Do you have a job?</b> <input type="radio" name="job" value="yes" />Yes
 <input type="radio" name="job" value="no" />No </p>
 </fieldset>
 
   <!-- 1 vopros -->
   
   <b>1. Why do You use online social media?</b>
   
  </p>
  <p>
   <input type="radio" name="bla" value="To chat with friends" />
   To chat with friends<br></br>
   <input type="radio" name="bla" value="To read news" /> To read news<br></br>
   <input type="radio" name="bla" value="To write blogs" /> To write blogs<br></br>
   <input type="radio" name="bla" value="Other" /> Other<br></br>
   
  </p>
  <p>
   <!-- 2 vopros -->
     
   <b>2. What online social media do You use more often?</b>
  </p>
   
  <p>&nbsp; </p>
  <p>
   <select name="more">
      
      <option value="MySpace">MySpace</option>
      <option value="Twitter">Twitter</option>
      <option value="Facebook">Facebook</option>
      <option value="LinkedIn">LinkedIn</option>
   </select> 
  </p>
  <p>&nbsp;</p>   
    
    <!-- 3 vopros -->
              
     <b>3. When do You use it?</b>
  <p>
    <input type="radio" name="use" value="1" /> At home<br></br>
    <input type="radio" name="use" value="2" /> At work<br></br>
    <input type="radio" name="use" value="3" /> At school<br></br>
    <input type="radio" name="iuse" value="4" /> In the bus/train<br></br>
    <input type="radio" name="use" value="5" /> Other<br></br>
   
  </p>
    <p><b>4. How much hours approximately do You spend on social media?</b>
    </p>
     <select name="hours">
     
      <option value="less than 2 hours">less than 2 hours a day</option>
      <option value="2-4 hours">2-4 hours a day</option>
      <option value="4-8 hours">4-8 hours a day</option>
      <option value="8-12 hours">8-12 hours a day</option>
      <option value="more than 12 hours">more than 12 hours a day</option>
     </select> 
     
   
  <p>&nbsp;</p>
    
      
      <p>
      <!-- 5 vopros -->
      
      <b>5. Do You use social media often?</b></p>
      <p>
     
      <input type="radio" name="often" value="Yes" />
      Yes
    <input type="radio" name="often" value="No" /> No
     
      
      <!-- 6 vopros -->
      </p>
      <p><b>6. Social Media website to which You usually upload</b></p>
  <p>
     <input type="radio" name="upload" value="Youtube" /> Youtube<br></br>
    <input type="radio" name="upload" value="Flickr" /> Flickr<br></br>
    <input type="radio" name="upload" value="Photobucket" /> Photobucket<br></br>
    <input type="radio" name="upload" value="Slideshare" /> Slideshare<br></br>
    <input type="radio" name="upload" value="Other" /> Other 
  </p>
   
     <!-- 7 vopros -->
     
    <b>7. Where do You chat with Your friends</b>
  
  <select name="chatting">
    
   <option value="Msn">Msn</option>
    <option value="Skype">Skype</option>
    <option value="Yahoo!">Yahoo!</option>
    <option value="Other">Other</option>
  </select>
  <p>&nbsp;</p>
 
  
   
   <!-- 8 vopros -->

 <b>8. You use social media for</b>  
  
   
   <select name="using">
    
    <option value="Personal reasons">Personal reasons</option>
    <option value="Professional reasons">Professional reasons</option>
    <option value="Don't use it">Don't use it</option> 
   </select>
   
  <p>&nbsp;</p>

 
 
  <p>
   <!-- 9 vopros -->
   
   <b>9. You prefer to obtain the information You need at</b> 
   
   
   <select name="information">
    
    <option value="Yahoo!">Yahoo!</option>
    <option value="Google">Google</option>
    <option value="Wikipedia">Wikipedia</option>
    <option value="Ask">Ask</option>
    <option value="Other">Other</option> 
   </select>
   </p>
  
   
   
   <!-- 10 vopros -->
   
   <b>10. What do You prefer to do being online</b>?
  
   
   <select id="drop" name="online">
    <option value="Read blogs">Read blogs</option>
    <option value="Chat with friends">Chat with friends</option>
    <option value="Watch videos">Watch videos</option>
    <option value="Read news">Read news</option>
    <option value="Other">Other</option> 
   </select>
  
  
  <!-- konec voprosov -->
  
  <!-- button-submit -->
  <p align="center">
 <input type="submit" value="Submit" onclick="return formvalid()" />
 </p>
 </form>
<!-- end #container -->
</p>
</div>
</body>
</html>
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "---/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="....org/1999/xhtml">
  3. <head>
  4. <script type="text/javascript">
  5. <!--
  6. //-->
  7. function checkform ( form )
  8. {
  9.  if (form.occupation.value == "") {
  10.   alert( "Please enter your occupation." );
  11.   form.occupation.focus();
  12.   return false ;
  13.  }
  14.  return true ;
  15. }
  16. function checkform(f) {
  17.  for (var i=0; i<f.elements("gender").length;
  18.   i++) {
  19.   var radio = f.elements("gender")[i];
  20.   if (radio.checked) {
  21.    return true;
  22.   }
  23.  }
  24.  // no checked radio button found
  25.  window.alert("Choose your gender!");
  26.  f.elements("gender")[0].focus();
  27.  return false;
  28. }
  29. function checkform(f) {
  30.  for (var i=0; i<f.elements("job").length;
  31.   i++) {
  32.   var radio = f.elements("job")[i];
  33.   if (radio.checked) {
  34.    return true;
  35.   }
  36.  }
  37.  // no checked radio button found
  38.  window.alert("Choose if you have a job!");
  39.  f.elements("job")[0].focus();
  40.  return false;
  41. }
  42. function checkform(f) {
  43.  for (var i=0; i<f.elements("bla").length;
  44.   i++) {
  45.   var radio = f.elements("bla")[i];
  46.   if (radio.checked) {
  47.    return true;
  48.   }
  49.  }
  50.  // no checked radio button found
  51.  window.alert("Answer question number 1");
  52.  f.elements("bla")[0].focus();
  53.  return false;
  54. }
  55. function checkform(f) {
  56.  for (var i=0; i<f.elements("use").length;
  57.   i++) {
  58.   var radio = f.elements("use")[i];
  59.   if (radio.checked) {
  60.    return true;
  61.   }
  62.  }
  63.  // no checked radio button found
  64.  window.alert("Answer question number 3!");
  65.  f.elements("use")[0].focus();
  66.  return false;
  67. }
  68. function checkform(f) {
  69.  for (var i=0; i<f.elements("often").length;
  70.   i++) {
  71.   var radio = f.elements("often")[i];
  72.   if (radio.checked) {
  73.    return true;
  74.   }
  75.  }
  76.  // no checked radio button found
  77.  window.alert("Answer question number 5!");
  78.  f.elements("often")[0].focus();
  79.  return false;
  80. }
  81. function checkform(f) {
  82.  for (var i=0; i<f.elements("upload").length;
  83.   i++) {
  84.   var radio = f.elements("upload")[i];
  85.   if (radio.checked) {
  86.    return true;
  87.   }
  88.  }
  89.  // no checked radio button found
  90.  window.alert("Answer question number 6!");
  91.  f.elements("upload")[0].focus();
  92.  return false;
  93. }
  94. </script>
  95. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  96. <title>Questionaire</title>
  97. <link href="oneColLiqCtrHdr19.css" rel="stylesheet" type="text/css" />
  98. <style type="text/css">
  99. <!--
  100. body {
  101.     background-color: #FFF;
  102.     background-image: url(images/aa.jpg);
  103. }
  104. -->
  105. </style></head>
  106. <body class="oneColLiqCtrHdr">
  107. <div id="container">
  108. <div id="header">
  109.   <h1>&nbsp;</h1></div>
  110.   
  111.   <p>
  112.    <!-- forms -->
  113.    
  114.    
  115.    
  116.  <form action="...../interaction/saveforminfo.aspx" method="post" onsubmit="return checkform(this);">
  117.    
  118.  <input type="hidden" name="surveyid" value="knjuku2" />
  119.  <input type="hidden" name="usecookie" value="true" />
  120.  <input type="hidden" name="landingpage" value="http.../thanks.html" /> 
  121.  
  122.  <!--.../interaction/viewdb.aspx?surveyid=knjuku2-->
  123. <p align="center"><b>This survey was made for Business Academy Copenhagen North project not for FDIM.</b></p>
  124.   <p>
  125. <fieldset>
  126. <div align="center">
  127.  <b>Please enter your personal information</b>
  128. </div>
  129. <p align="center"><b>Your Occupation:</b>
  130.  <input type="text" name="occupation" /><br /></p>
  131. <p align="center">
  132.  <b>Age Group:</b> <select name="age">
  133.   <option value="under 18">less then 18</option>
  134.   <option value="18-25">18-25</option>
  135.   <option value="26-35">26-35</option>
  136.   <option value="over 35">more then 35</option>
  137.   </select></p>
  138. <p align="center">
  139.  <b>Status:</b> <select name="status">
  140.  <option value="single">Single</option>
  141.  <option value="single with children">Single with children</option>
  142.  <option value="in relationship">In relationship</option>
  143.  <option value="married">Married</option>
  144.  <option value="divorced">Divorced</option>
  145.  </select></p>
  146.  <p align="center"><b>Gender:</b>
  147.  <input type="radio" name="gender" value="male" /> Male
  148.  <input type="radio" name="gender" value="female" /> Female<br /></p>
  149.  
  150.  <p align="center">
  151.   <b>Do you have a job?</b> <input type="radio" name="job" value="yes" />Yes
  152.  <input type="radio" name="job" value="no" />No </p>
  153.  </fieldset>
  154.  
  155.    <!-- 1 vopros -->
  156.    
  157.    <b>1. Why do You use online social media?</b>
  158.    
  159.   </p>
  160.   <p>
  161.    <input type="radio" name="bla" value="To chat with friends" />
  162.    To chat with friends<br></br>
  163.    <input type="radio" name="bla" value="To read news" /> To read news<br></br>
  164.    <input type="radio" name="bla" value="To write blogs" /> To write blogs<br></br>
  165.    <input type="radio" name="bla" value="Other" /> Other<br></br>
  166.    
  167.   </p>
  168.   <p>
  169.    <!-- 2 vopros -->
  170.      
  171.    <b>2. What online social media do You use more often?</b>
  172.   </p>
  173.    
  174.   <p>&nbsp; </p>
  175.   <p>
  176.    <select name="more">
  177.       
  178.       <option value="MySpace">MySpace</option>
  179.       <option value="Twitter">Twitter</option>
  180.       <option value="Facebook">Facebook</option>
  181.       <option value="LinkedIn">LinkedIn</option>
  182.    </select> 
  183.   </p>
  184.   <p>&nbsp;</p>   
  185.     
  186.     <!-- 3 vopros -->
  187.               
  188.      <b>3. When do You use it?</b>
  189.   <p>
  190.     <input type="radio" name="use" value="1" /> At home<br></br>
  191.     <input type="radio" name="use" value="2" /> At work<br></br>
  192.     <input type="radio" name="use" value="3" /> At school<br></br>
  193.     <input type="radio" name="iuse" value="4" /> In the bus/train<br></br>
  194.     <input type="radio" name="use" value="5" /> Other<br></br>
  195.    
  196.   </p>
  197.     <p><b>4. How much hours approximately do You spend on social media?</b>
  198.     </p>
  199.      <select name="hours">
  200.      
  201.       <option value="less than 2 hours">less than 2 hours a day</option>
  202.       <option value="2-4 hours">2-4 hours a day</option>
  203.       <option value="4-8 hours">4-8 hours a day</option>
  204.       <option value="8-12 hours">8-12 hours a day</option>
  205.       <option value="more than 12 hours">more than 12 hours a day</option>
  206.      </select> 
  207.      
  208.    
  209.   <p>&nbsp;</p>
  210.     
  211.       
  212.       <p>
  213.       <!-- 5 vopros -->
  214.       
  215.       <b>5. Do You use social media often?</b></p>
  216.       <p>
  217.      
  218.       <input type="radio" name="often" value="Yes" />
  219.       Yes
  220.     <input type="radio" name="often" value="No" /> No
  221.      
  222.       
  223.       <!-- 6 vopros -->
  224.       </p>
  225.       <p><b>6. Social Media website to which You usually upload</b></p>
  226.   <p>
  227.      <input type="radio" name="upload" value="Youtube" /> Youtube<br></br>
  228.     <input type="radio" name="upload" value="Flickr" /> Flickr<br></br>
  229.     <input type="radio" name="upload" value="Photobucket" /> Photobucket<br></br>
  230.     <input type="radio" name="upload" value="Slideshare" /> Slideshare<br></br>
  231.     <input type="radio" name="upload" value="Other" /> Other 
  232.   </p>
  233.    
  234.      <!-- 7 vopros -->
  235.      
  236.     <b>7. Where do You chat with Your friends</b>
  237.   
  238.   <select name="chatting">
  239.     
  240.    <option value="Msn">Msn</option>
  241.     <option value="Skype">Skype</option>
  242.     <option value="Yahoo!">Yahoo!</option>
  243.     <option value="Other">Other</option>
  244.   </select>
  245.   <p>&nbsp;</p>
  246.  
  247.   
  248.    
  249.    <!-- 8 vopros -->
  250.  <b>8. You use social media for</b>  
  251.   
  252.    
  253.    <select name="using">
  254.     
  255.     <option value="Personal reasons">Personal reasons</option>
  256.     <option value="Professional reasons">Professional reasons</option>
  257.     <option value="Don't use it">Don't use it</option> 
  258.    </select>
  259.    
  260.   <p>&nbsp;</p>
  261.  
  262.  
  263.   <p>
  264.    <!-- 9 vopros -->
  265.    
  266.    <b>9. You prefer to obtain the information You need at</b> 
  267.    
  268.    
  269.    <select name="information">
  270.     
  271.     <option value="Yahoo!">Yahoo!</option>
  272.     <option value="Google">Google</option>
  273.     <option value="Wikipedia">Wikipedia</option>
  274.     <option value="Ask">Ask</option>
  275.     <option value="Other">Other</option> 
  276.    </select>
  277.    </p>
  278.   
  279.    
  280.    
  281.    <!-- 10 vopros -->
  282.    
  283.    <b>10. What do You prefer to do being online</b>?
  284.   
  285.    
  286.    <select id="drop" name="online">
  287.     <option value="Read blogs">Read blogs</option>
  288.     <option value="Chat with friends">Chat with friends</option>
  289.     <option value="Watch videos">Watch videos</option>
  290.     <option value="Read news">Read news</option>
  291.     <option value="Other">Other</option> 
  292.    </select>
  293.   
  294.   
  295.   <!-- konec voprosov -->
  296.   
  297.   <!-- button-submit -->
  298.   <p align="center">
  299.  <input type="submit" value="Submit" onclick="return formvalid()" />
  300.  </p>
  301.  </form>
  302. <!-- end #container -->
  303. </p>
  304. </div>
  305. </body>
  306. </html>
  • bido
  • Newbie
  • Newbie
  • bido
  • Posts: 6

Post 3+ Months Ago

Please!! Help me someone!
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

Most of those errors come from JavaScript. Instead of having javascript in one page, include the javascript into the page (<script type="text/javascript" src="path/to/javascript.js"></script>)

The last error is that you put a <div> inside of a <fieldset>
  • bido
  • Newbie
  • Newbie
  • bido
  • Posts: 6

Post 3+ Months Ago

Bogey wrote:
Most of those errors come from JavaScript. Instead of having javascript in one page, include the javascript into the page (<script type="text/javascript" src="path/to/javascript.js"></script>)

The last error is that you put a <div> inside of a <fieldset>


Ok, thank you very much for the answer, you really helped me!

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 19 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
 
cron
 

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