This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

 
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?
 
author & internet detective
Marshal
Posts: 38508
653
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.
 
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?
 
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();">
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!