Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes Dynamic message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamic message " Watch "Dynamic message " New topic
Author

Dynamic message

Achal Jalan
Greenhorn

Joined: Nov 23, 2004
Posts: 21
Hi,

Hi,

In the code below,

Row1 of the table has a drop down menu
In row2 I need to display an appropriate msg depending on the choice the user made in row1.

Could you please advise me on the best way to go about it.

Any sample code would be very very helpful.

The code below is just a subsection of the actual jsp page, thus I need to be able to do this without going to the servlet.


THE JAVASCRIPT




THE RELEVEANT HTML




The obove doesnt seem to work and gives me an error " 'result' object not found. "...

Thanks in advance for all the help
Achal
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
For each <tr> tag for your optional rows, add the following:

id="<<put descriptive name here>>" "style="visibility:hidden; display:none"

then add an onChange event to your html:select tag that calls a javaScript function. In that function, put logic that will display only the rows that need to be there based on what was selected. To redisplay a row, use something like this:

document.getElementById("row1").style.visibility="visible";
document.getElementById("row1").style.display="inline";


Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dynamic message
 
Similar Threads
Struts 1.x, 2, jstl questions
struts tag problem ?
bean:write tag - query
using ajax and struts iterate tags
two forms on one jsp.