0

I'm using Struts 1.3.8. In my JSP there is a select option with dynamically populated items in it.
How do I perform validations on the select option when the user doesn't select any item? The required rule is not working. Any idea or suggestions? Reply is highly appreciated, thanks.

Mr.Chowdary
  • 517
  • 1
  • 6
  • 18

1 Answers1

0

create temporary option like

<select name="selectItem">
   <option value="-1" >-----Select-----</option>
   .
   .
</select>

call java script function on form submit where check something like

if((document.Form1.selectItem[document.Form1.selectItem.selectedIndex].value)=='-1')
 return false;
else
 return true;
Paul Richter
  • 10,908
  • 10
  • 52
  • 85
Veerayya
  • 61
  • 1
  • 3