Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Javascript JavaScript Combo Box Validation

Related Tutorials


 
 

Share on Google+Share on Google+

JavaScript Combo Box Validation

Advertisement
In this example we create a combo box of different technologies where if user select any technology and press the submit.

JavaScript Combo Box Validation

     

This application illustrates how to validate the combo box using JavaScript validation.

In this example we create a combo box of different technologies where if user select any technology and press the submit button then he/she successfully process the next step of the application but if user not select any technology then he/she got a alert message.

 

The Example is as follows:

 

Source Code of combo.html 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
  <TITLE>ComboBox Validation</TITLE>

  <script Language="JavaScript">
  function validateR(){
  var selectedCombobox=(comboForm.technology.value);
  if (selectedCombobox=="-1") {
  alert("Please Select Technology");
  return false;
  }
  return true;
  }
  </script>

  
 </HEAD>

 <BODY>
  <form name="comboForm">
  <select name="technology">
  <option value="-1">Select</option>
  <option value="JSP">Java Server Pages</option>
  <option value="Servlet">Servlet</option>
  <option value="PHP">PHP</option>
  <option value="ASP">ASP</option>
  </select>

  <input type="submit" value="submit" onclick="return validateR();">
  </form>
  
 </BODY>
</HTML>

 

Download Source Code

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 29, 2009

Related Tutorials

Discuss: JavaScript Combo Box Validation   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
sobin joy
June 11, 2012
about this answer

very good
DMCA.com