Topic
No replies
SystemAdmin
SystemAdmin
6420 Posts
ACCEPTED ANSWER

Pinned topic Problem with disabled radio button

‏2012-10-02T11:44:00Z |
Hi there!

I have a jsp with two radio buttons that are disabled when the user is going to insert a new record in the database. These buttons are supposed to be enabled for selection only when the user is editing a record.

In the "include" mode, the jsp contains a h:inputHidden with a value pointing to a property in the managed bean, like this:

<h:inputHidden value="#{pc_ManagedBean.transferObject.status}" />

The disabled radio buttons are defined with a h:selectOneRadio pointing to the same property as the hidden, which is supposed to hold the default value. They are defined like this:

<h:selectOneRadio id="status" style="font:12"
disabled="#{pc_ManagedBean.include}"
value="#{pc_ManagedBean.transferObject.status}">
<f:selectItem itemLabel="Active" itemValue="1" />
<f:selectItem itemLabel="Inactive" itemValue="0" />
</h:selectOneRadio>

The ManagedBean is defined on the request scope, and before the page is rendered, the transferObject.status property is set to "Active" in the ManagedBean. This way, the user gets to see the two disabled radio buttons, with the "Active" one being selected and uneditable.

In WebSphere Application Server 6.1, with JSF 1.1, this was working OK. When the user submitted the page, the transferObject.status attribute was getting set to "Active" due to the hidden.

After upgrading the application to WebSphere Application Server 7.0, with JSF 1.2, this page stopped working. After some debugging I learned that the disabled input is overriding the hidden's value, and the transferObject.status property is getting set twice: the first time with "Active", due to the hidden, and the second time with null, due to the disabled radio.

Since disabled inputs are not supposed to be processed by JSF, I do not understand why this is happening. Can someone help me with this?