Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic