Anet wrote:
Hi everybody;
  I have some tables on my page. each of them contains some of properties. for 
the first time, tables are hidden and will be displayed by this javascript code:
  function toggle(id){
 var id = id;
 var table = document.getElementById(id);
 if(table.style.display=="none"){
  table.style.display="";
 }else if (table.style.display==""){
  table.style.display="none";
 }
}
  and in my jsp page for example:
  <p><html:img page="/images/down_enabled.gif" 
onclick="toggle('userpass');"/></p>
  <table id="userpass" style="display:none" border="0">
       <tr>
           <td colspan="2" height="5">some property here</td>
       </tr>
</table>
  they will be shown by clicking on the image.(down_enabled.gif)
  The struts validation works on my form correctly.but I want when a property is in one 
of these tables and the validator returns "false" on it, the table will be 
shown. I don't know how to use result of validation? any idea?

I see an html:img tag in there, so I'm assuming you're using Struts 1. You can use the messagesPresent tag [1] to conditionally include a <script> block to set the table visible, or to set up a variable you can then use to switch on for setting the display style. Depending on how many of these you need to control, though, it may be cleaner to implement the logic in your action and just expose a map of property-name -> display style.

L.

[1] http://struts.apache.org/1.3.8/struts-taglib/tlddoc/logic/messagesPresent.html


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to