Home Javascript JavaScript Combo Box Validation



JavaScript Combo Box Validation
Posted on: January 29, 2009 at 12:00 AM
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

Related Tags for JavaScript Combo Box Validation:
ccomprocessselectapplicationbuttondiffiousersubmitthismessagelogappcreatetechnologiesiftechnologyieexamplealertboxwheretoexamprocshextesuccessitnotlimituseulceinnosubdifferentcombomntnextsagecaestechstepfullagemeproppcatxaxampssussaessatanyisllmplpresspregoeaandccrtsaxtttssrocrenthstatiapfegoticaicapleplprocesprmindonombomolo


More Tutorials from this section

Ask Questions?    Discuss: JavaScript Combo Box Validation   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.