JSF : Disable drop down does not set value to backing bean
I have a requirment in which I need to disable a drop down on certain event through JavaScript and then submit the form. The problem is that when the drop down component is disabled the value in the drop down is not set through the backing bean.
I tried to disable the drop down 开发者_如何转开发componenet through div and span but it has not worked.
Can anyone suggest how can I submit the value of a disabled compoement to the backing bean? OR do i really need to idsable that component, I mean how can I achive this using div or span?
Chapter 17.12.1 of the HTML forms specification says the following (emphasis mine)
17.12.1 Disabled controls
...
When set, the disabled attribute has the following effects on an element:
- Disabled controls do not receive focus.
- Disabled controls are skipped in tabbing navigation.
- Disabled controls cannot be successful.
...
Note the last point. In other words, they are never submitted to the server. Thus, the behaviour you're seeing is fully correct and expected as per the HTML forms specification.
To achieve your requirement, you need to disable it after submission.
精彩评论