This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is It Possible to Invoke An Action By Selecting an Option from a Drop-Down Menu?

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can invoke actions by clicking on a Submit button or by clicking on a link. Is it possible to invoke an action by selecting an option from a drop-down menu? If the answer is "yes", how do we do it?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JiaPei,
Yes, but you need to use Javascript too. If there is a different action depending on the value, you need to set that action. Regardless, use javascript to submit the form


(blur should be onBlur), but it's not letting me post that.
 
Kunal Bhattacharya
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing the same error.
When I try starting tomcat. I get the following error -

Sep 8, 2006 2:37:59 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /ch03app threw load() exception
javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-config.xml

Here is the entry in struts-config.xml

<action-mappings>
<action path="/Lookup"
type="ch03.LookupAction"
name="LookupForm" />
<forward name="success" path="/quote.jsp" />
<forward name="failure" path="/index.jsp" />
</action>
</action-mappings>


Can someone help me on this?
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OnBlur is fired even when the option is not changed. I believe the better way is to use OnChanged and OnBlur together. Something like below



and make the selection control like

<select name="change1" on blur="submitChange(this.form);" on change="onChangedSelection();">
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic