JavaScript Combo Box Validation

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

Ads

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

Advertisements

Ads
Share on Google+Share on Google+

JavaScript Combo Box Validation

Posted on: January 29, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

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

Ads

 

Ads