• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to enable and disable a dropdown list.

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I my JSP, I have two drop down list, I want to enable or disable the second drop down list based on the selection from first drop down list, how I can implement this in JSP?
Here are the two drop down list.
<tr>
<td colspan="2" align="left">
<html:select property="selectedVerification">
<html ption value="">--please select a verification--</html ption>
<html ption value="0"> Scores Verification </html ption>
<html ption value="1"> Enrollment Verification </html ption>
<html ption value="2"> Semester GPA Verification</html ption>
<html ption value="3"> Degree Verification</html ption>
</html:select>
<div id="theSpot"/>
</td>
</tr>
<tr>
<td colspan="2" align="left">
<select name="selectedSession">
<option value="">----please select a session----</option>
...........
</td>
</tr>
I want to enable the second dropdown list only when user selected Semester GPA Verification.
Thanks for your help!
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First off, it's not going to be implemented in JSP. That would require client-side scripting, such as JavaScript. You'd have to add something like an "onSelect" script handler to the <select> and/or <option> tags, to execute a script which would alter the "enabled" property of the item.
 
Kan Qiu
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Could you show me how to do it in the Javascript?
 
Billybob Marshall
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kan Qiu:
Thanks, Could you show me how to do it in the Javascript?


No, but I've given you hints to search for. How about searching the web for examples?
Something like this: Google search
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the HTML/Javascript forum.
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<FORM>
<select name="n1" onchange="this.form.n2.disabled=this.options[this.selectedIndex].value == 2;">
<option value="0"> </option>
<option value="1">aaa</option>
<option value="2">bbb</option>
<option value="3">ccc</option>
</select>

<select name="n2" disabled>
<option>bbb</option>
<option>aaa</option>
</select>
</FORM>
 
reply
    Bookmark Topic Watch Topic
  • New Topic