The moose likes JSF and the fly likes How to use javascript to hide a jsf form element question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSF
Reply Bookmark "How to use javascript to hide a jsf form element question" Watch "How to use javascript to hide a jsf form element question" New topic
Author

How to use javascript to hide a jsf form element question

Dan MacLeod
Ranch Hand

Joined: Mar 19, 2009
Posts: 30
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
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14573
    
    7

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Dan MacLeod
Ranch Hand

Joined: Mar 19, 2009
Posts: 30
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
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14573
    
    7

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use javascript to hide a jsf form element question
 
Similar Threads
AJAX or JavaScript
how do you spread the radio buttons of a selectOneRadio
radio button inside a datatable
how to hide some component using javascript
requirement gathering for User Interfaces