• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use javascript to hide a jsf form element question  RSS feed

 
Dan MacLeod
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm tyring to hide a <h:selectOneListbox when a user selects a radio button. When the radio button is clicked, I call a javascript function to hide the component, but the component does not get hiden. I've verified the component id is correct. Can someone tell me what I'm doing wrong in my js?

thanks

document.getElementById("geoUpdater_1_j_id_id0:myForm:geoType").hide();
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the recommended way these days is to set the "visible" attribute false. Or there's a screwball block-render option whose details I forget. JavaScript is a bit tough in that area.
 
Dan MacLeod
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, I figured it out late last night.

if ("ASSET" == radio){
document.getElementById(comp).style.display = 'block';
} else {
document.getElementById(comp).style.display = 'none';
}
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep. That was the "screwblass block option". you found it.

Incidentally, meant to say "JavaScript is a bit rough in that area." Sometimes my keyboard has a mind of its own.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!