itemDisabled doesnt works in f:selectItem of h:selectOneMenu

Here is the dropdown in which itemDisabled="true" doesnt works for f:selectItem

<h:selectOneMenu id="manufList" value="#{manufacturerBean.selectedManufacturer}" >

<f:selectItem itemLabel="New" itemValue="New" itemDisabled="true" />

<f:selectItems value="#{manufacturerBean.manufacturerList}" />

<a4j:support action="#{manufacturerBean.loadManufacturerDetails}" event="onchange" reRender="manufName,manufDescription,manufSource,btnSave,btnDelete" />

</h:selectOneMenu>

Any pointers/suggestions will be appreciated

Regards

Bansi

[616 byte] By [mail2bansia] at [2007-11-27 5:10:08]
# 1

Forgot to mention in my earlier posting ................

I have observed itemDisabled="true" works in Firefox browser but not in IE.

Even in Firefox browser the item is disable only onChange i.e. pick different value form the list. I want the item to be disable as soon as the page loads

The dropdown is the first component in my JSF page and it does CRUD operation. The first value in the dropdown is "New".

When users pick "New" value from the dropdown it facilitates Create operation

If users pick a value othet than "New" from the dropdown then all other fields are dynamically populated facilitating "Update" operation

As picking "New" value from dropdown results in "Create" operation so its role based and needs to be disabled as follows

<f:selectItem itemLabel="New" itemValue="New" itemDisabled="#{manufacturerBean.hasRole}" />

which unfortunately doesnt work as soon as the page loads

I am setting the value for property "hasRole" in the Constructor of backing bean as shown below

public ManufacturerBean() {

System.out.println("Inside Manuf Constructor");

UserInfo userInfo = UserInfoHolder.getUserInfo();

userRoles = userInfo.getUserRoles();

Iterator it = userRoles .iterator();

while (it.hasNext()) {

// Get element

userRole = (UserRole) it.next();

roleName = (String) userRole.getNamsRole().getName();

}

if (roleName.equals("NAMS Admin"))

hasRole=true;

else

hasRole=false;

}

Any pointers/suggestions will be highly appreciated

Regards

Bansi

mail2bansia at 2007-7-12 10:30:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...