This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes calling another .do call on changing the value from Dropdown Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "calling another .do call on changing the value from Dropdown Box" Watch "calling another .do call on changing the value from Dropdown Box" New topic
Author

calling another .do call on changing the value from Dropdown Box

andrew ronchi
Ranch Hand

Joined: Nov 03, 2011
Posts: 41

i have a dropdown box in my struts application. onchange,i want to call another .do call with id of that selected value...?how cn i do that...
Alberto Dousdebes
Greenhorn

Joined: Sep 02, 2008
Posts: 22
Hi!

You can call a JavaScript function in "onChange" event. This function retrieves the selected value and call any action you want:



And the javaScript function



Havent tested but it's an idea.

bye!
john lazeraski
Ranch Hand

Joined: Nov 14, 2011
Posts: 76
Are you using a library like jQuery or Prototype? If so, you can set a click handler to call a JS function, which in turn makes an ajax request to the .do action.
andrew ronchi
Ranch Hand

Joined: Nov 03, 2011
Posts: 41

thanks a lot guys....it worked...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: calling another .do call on changing the value from Dropdown Box