You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matt Hughes <mh...@chariotsolutions.com> on 2006/06/30 23:12:01 UTC

Way to disable all child elements?

Say you have a large form with 50 some input elements on it.  Based on a 
simple boolean flag in your backing bean, you want to disable all of 
those fields.  Is there any way to disable them all *other than* putting 
disabled="#{backingBean.disabled}" onto each and every element?

I was thinking something along the lines of

<h:form disabled="#{backingBean.disabled}">
....100s of elements
</h:form>

which would disable all the children of that form.


So far as I can tell there is no easy way to do this in your backing 
bean, as setDisabled()/isDisabled() are *not* methods on UIInput, but 
are on every child of UIInput.  I don't really want to do a 'instanceof' 
for every child of UIInput, and then cast to call setDisabled().

Any ideas?

Re: Way to disable all child elements?

Posted by Mert Çalışkan <mc...@gmail.com>.
You can use HtmlPanel
v1.1b<http://sourceforge.net/project/showfiles.php?group_id=137466&package_id=192768>.
It has disabled, readonly and rendered attributes.

Regards,

Mert
http://www.jroller.com/page/mert


On 7/1/06, Matt Hughes <mh...@chariotsolutions.com> wrote:
>
> Say you have a large form with 50 some input elements on it.  Based on a
> simple boolean flag in your backing bean, you want to disable all of
> those fields.  Is there any way to disable them all *other than* putting
> disabled="#{backingBean.disabled}" onto each and every element?
>
> I was thinking something along the lines of
>
> <h:form disabled="#{backingBean.disabled}">
> ....100s of elements
> </h:form>
>
> which would disable all the children of that form.
>
>
> So far as I can tell there is no easy way to do this in your backing
> bean, as setDisabled()/isDisabled() are *not* methods on UIInput, but
> are on every child of UIInput.  I don't really want to do a 'instanceof'
> for every child of UIInput, and then cast to call setDisabled().
>
> Any ideas?
>