]
Anton Belevich reassigned RF-5595:
----------------------------------
Assignee: Anton Belevich
Combobox loses it's value if value is entered by user and
component is ajax re-rendered
---------------------------------------------------------------------------------------
Key: RF-5595
URL:
https://jira.jboss.org/jira/browse/RF-5595
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.2.2
Environment: Firefox 2 - 3, IE6 / 7, Safari, Opera,....
Reporter: Brian Couchman
Assignee: Anton Belevich
Fix For: 3.3.0
When a rich:combobox is on a page, with enableManualInput=true, user can type a value in
the box that is not in the list of propositions.
At that moment, the hidden input is properly populated.
If an ajax request is fired on the page, and the combobox is rerendered, the input text
still contains the user value, but the hidden input is empty, and any next submit (ajax or
not) empties the bean bound to the combobox object.
The issue comes from the renderer of the Combobox
In the class ComboboxRenderer, doEncodeEnd(), at line 560 we see this code :
{code:title=ComboboxRenderer.java}
String hiddenValue = null;
if (items.contains(value)) {
variables.setVariable("hiddenValue", value);
}
{code}
which means : "If the value in the field is not part of the list of propositions, do
not fill the hidden input with it". The input text is properly filled and it breaks
the symetry (user sees a value in the box but another value is saved in the bean).
If enableManualInput=true, meaning the user can type his own value, there should be no
check if the value is in the propositions or not, and the hidden field should be filled
the same way the input text is.
Code should look like :
{code:title=ComboboxRenderer.java}
String hiddenValue = null;
if (enableManualInput || items.contains(value)) {
variables.setVariable("hiddenValue", value);
}
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: