• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Can I have two Action for one Form

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Fire me boy! Cool, soothing, shameless self promotion:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic