This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Can I have two Action for one Form

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is I have a page that needs to call an Action when a "onchange" event occurs in a combo box ... that's s� a can make dependent combos in my page ... so I send the Form Bean with the value in my top combo ... OK ...

Now I need to call the Action from the submit button Action :roll:

do I send a value in the request so I can defer in my Action Class ??? how do I do that ???
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can chain actions by using a <forward/> for the first action that points to another action. I.e. something like this:

(please forgive me if I got the ".do"'s wrong -- I never remember where to include the suffix and where to omit it...)
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could change the action via javascript in the onchange of the box and then submit it
document.forms[0].action = 'action.do'
forms[0].submit()

something like that...
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought you couldn't have two actions on a form.
But you could make a form attribute called "myAction"
inside the html tags declare a hidden attribute "myAction"
and then on the the various actions that you would submit the form use javascript to change the value of my aciont then do the submit.

Inside of your one action you can reference this hidden variable and decide what to do based on that (and what forward to return).


hope that helps.

-Tad
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!