• Post Reply Bookmark Topic Watch Topic
  • New Topic

I�m trying to remove a commandButton with an image attribute using JavaScript  RSS feed

 
Ed soares
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I�m trying to remove a <h:commandButton with an image attribute using JavaScript, but it does not work
I have a

<h:commandButton id="botao" value="Botao" action="#{validaUsuario.voltaList}" image="#{facesContext.externalContext.requestContextPath}/imagens/BACK.gif" alt="Volta para a lista de relat�rios"/>

and I try to remove it using the following command in JavaScript:
document.forms['form_1'].elements['form_1:botao'].style.visibility = 'hidden';

It does not work.

If I take the attribute image off it works fine!

Please any help

thanks

Ed
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
put a div tag around your button and use javascript to set the 'display' style of div to 'none'

<div id="info">
<h:commandButton image="cdDrive.gif" id="imagebtn" />
</div>

get the div in your javascript method

var obj = window.document.getElementById("info").style;
obj.display = "none";

Hope it helps !

Thanks,
 
Ed soares
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks man, it worked fine.

Thanks a lot
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!