views:

162

answers:

2

I want to hide and show the table row based on a condition. The id of my atable row is showhide2.

This is my part of code to use show/hide the row

<%if(group.equals("Y")){%>
                         <input<% try{if(dTO.getStat() == 0){%> style="display:none;" <%}}catch(Exception ex){} %> type="button" value="View" id="btnview" name="btnview"   onclick="statusChange('view', 'add_userFrm');hide_menu('showhide2');loadDataForGivenDiv('add_userFrm');" class="button" style="width:100px"/>
                        <%}else{ %><input<% try{if(dTO.getStat() == 0){%> style="display:none;" <%}}catch(Exception ex){} %> type="button" value="View" id="btnview" name="btnview" onclick="statusChange('view', 'add_userFrm');show_menu('showhide2');loadDataForGivenDiv('add_userFrm');" class="button" style="width:100px"/>
                         <%}%>

But the button "View" not shows in my application.I cant solve this.

This is the function used to hide the row

function hide_menu(id){
                            document.getElementById(id).style.display = "none";
                            document.getElementById(id).style.width = "0";

                        }

I guess problem is in my code which has the button "View"

A: 

In both if and else you set display to none, could that be it?

Anders Eriksson
i have removed display of none and checked.but still the View button is not showing.
devuser
Have you tried Vincents tip from above and view the rendered source in the web browser? To see if the input are there or if the group is Y.
Anders Eriksson
A: 

You could try adding any character in front of the input tag

e.g.

<%if(group.equals("Y")){%>
                     a<input<% try{if(dTO.getStat() == 0){%> style="display:none;"      <%}}catch(Exception ex){} %> type="button" value="View" id="btnview" name="btnview"   onclick="statusChange('view', 'add_userFrm');hide_menu('showhide2');loadDataForGivenDiv('add_userFrm');" class="button" style="width:100px"/>

If the 'a' does not show then

if(group.equals("Y")) 

is probably always false

plodder