Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting an OPTION tag's text property from the request object

 
Micah Holroyd
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to access an HTML drop-down as show below...
<select name="regionCode">
<option value="AZFINT">Flagstaff
<option value="AZPINT">Phoenix
</select>
... and HttpServletRequest.getParameter("regionCode") will properly display the OPTION's value (AZFINT or AXPINT).
But how can I get at the text that is shown to the user? (Flagstaff or Phoenix)
I know that there is a Javascript variable to get the text property, so if all else fails I can use that. But I'm being stubborn and want to get it out of the servlet's request object. Any ideas?
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think we can grab the values shown to users from HTTPRequest object. All that is transmitted to the server is the 'VALUE' part.
May be we can write a onlclick javascript fn for each option and inside the javascript fn try to change a hidden var value.
This will do for single selection list.For multiple selection case we may have to think of better solution.
Others can add to this.
regds
maha anna
 
Micah Holroyd
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks maha,
I'll go the way of javascript to get the text property. Then I'll put it in a hidden field and get it that way.
Thanks for the reply.
Micah
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic