Forums Register Login

selectOneMenu rendered while it shouldn't

+Pie Number of slices to send: Send
Hi,
I have the following code to create a selectOneMenu:
<h:selectOneMenu id="country" tabindex="12" value="#{myForm.country}" disabled="true"
>
<f:selectItems value="#{enumeratiesBean.countries}"/>
</h:selectOneMenu>

and it generates the following starttag:
<select id="body:myForm:country" name="body:myForm:country" size="1" tabindex="12">

The problem is that the disabled attribute is not being rendered at all. Does anyone know this problem?
Greets,
Rob
+Pie Number of slices to send: Send
Try disabled="disabled".

I think it's an html thing.
+Pie Number of slices to send: Send
rendered = "false" work?
+Pie Number of slices to send: Send
both disabled="disabled" and rendered="false" don't work
Grtz
Rob
+Pie Number of slices to send: Send
Sorry....rendered="false" does work but i want to display the item as disabled instead of not showing it at all. Btw. readonly="true" doesn't work either.
Grtz,
Rob
+Pie Number of slices to send: Send
Not real sure. Works ok for me.

+Pie Number of slices to send: Send
 

Originally posted by Rob HK:
Hi,
I have the following code to create a selectOneMenu:
<h:selectOneMenu id="country" tabindex="12" value="#{myForm.country}" disabled="true"
>
<f:selectItems value="#{enumeratiesBean.countries}"/>
</h:selectOneMenu>

and it generates the following starttag:
<select id="body:myForm:country" name="body:myForm:country" size="1" tabindex="12">

The problem is that the disabled attribute is not being rendered at all. Does anyone know this problem?
Greets,
Rob



Are you using JSF reference implementation and, if so, which version?
+Pie Number of slices to send: Send
We're using the Sun reference implementation version 1.1.
+Pie Number of slices to send: Send
 

Originally posted by Rob HK:
We're using the Sun reference implementation version 1.1.



It works ok for me but I'm using latest JSF RI release. Try RI 1.1_01.
+Pie Number of slices to send: Send
Hey guys,
Don't know what happened but suddenly it works ......maybe some duplicatie jsf library or so....anyway, thanx for replying.
+Pie Number of slices to send: Send
Hi

Can you tell me how did you do that. I am having a same problem that I want to render SelectOneMenu but want to display it as disabled.

Actually I need to do this on checkbox selection. If checbox is not selected then SElectOneMenu is disabled. How can we access "Disabled" attribute in managed bean?

Thanks
+Pie Number of slices to send: Send
Hi,
Well, i think for this occasion you could write a small javascript function to enable/disable the selectOneMenu if you check/uncheck the checkbox.
If you really want to disable the selectOneMenu through the backing bean i guess you could do something like this:

<h:selectOneMenu id="aId" value="#{aBean.value}" disabled="#{aBean.readOnly}"
<f:selectItems value="#{aBean.items}"/>
</h:selectOneMenu>

Where 'readOnly' is a method on the backingBean returning "true" or "false".
Hope this helps.
+Pie Number of slices to send: Send
Thanks Rob

I used second approach and it works fine.
get schwifty. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 5773 times.
Similar Threads
JSF drop down.
Issue With selectOneMenu ValueChangeListener Not Firing
The action of my commandButton does not work any more after using SelectOneMenu
Navigation not working due due SelectOneMenu object
Question with selectOneMenu
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:47:04.