That was helpful. But, I would like to try some other way to utilize the power
of JSF :).
Is there a action event or valuechange event for checkbox. Any idea?
Thanks.
Quoting Simon Kitching <[EMAIL PROTECTED]>:
> [EMAIL PROTECTED] wrote:
> > Hi,
> >
> > I need to display a list box when a checkbox is clicked. I guess we need
> to
> > implement OnSelect event for this purpose. Please, correct me here if I am
> wrong.
> > Does anybody have some examples of using onSelect in the backing bean?.
> Any help
> > is appreciated.
> >
>
> onSelect is a *client side* thing only. It is a normal HTML feature that
> allows an arbitrary piece of scripting to be run in the browser. Nothing
> to do with JSF at all.
>
> You could implement what you want entirely on the client by ensuring
> your page includes the listbox, but with its style set to display:none.
> You should then be able to specify some script in the checkbox onSelect
> attribute which finds that component and sets its style to visible. This
> is really not JSF at all but that doesn't mean it's a bad solution.
>
> Alternatively, I expect you could map the checkbox value to some boolean
> value on a backing bean, and use the same value to control the
> "rendered" attribute of the listbox.
> <h:selectBooleanCheckbox value="#{someBean.listBoxEnabled}"/>
> <h:selectManyListbox rendered="#{someBean.listBoxEnabled}" ... />
> The problem here is that you need some mechanism for submitting the
> entire form back to the server when the checkbox value is changed so the
> page can be regenerated.
>
>
> Maybe you can use tomahawk's collapsible panel control instead of the
> checkbox/listbox combination, and avoid the whole issue?
>
> Regards,
>
> Simon
>