File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I have two Action for one Form

 
Jose Pereira
Greenhorn
Posts: 12
  • 0
  • 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 ???
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • 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...)
 
Larry Johnson
Greenhorn
Posts: 4
  • 0
  • 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...
 
Tad Dicks
Ranch Hand
Posts: 264
  • 0
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic