File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

selectOneMenu rendered while it shouldn't

 
Rob HK
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try disabled="disabled".

I think it's an html thing.
 
Daniel Prene
Ranch Hand
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rendered = "false" work?
 
Rob HK
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
both disabled="disabled" and rendered="false" don't work
Grtz
Rob
 
Rob HK
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not real sure. Works ok for me.

 
Mauro Castaldo
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Rob HK
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're using the Sun reference implementation version 1.1.
 
Mauro Castaldo
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob HK
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,
Don't know what happened but suddenly it works ......maybe some duplicatie jsf library or so....anyway, thanx for replying.
 
Priti Shah
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rob HK
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Priti Shah
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob

I used second approach and it works fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic