dennis hoersch created MYFACES-3667:
---------------------------------------
Summary: UIInput renders the old value after required validation
error if field is empty
Key: MYFACES-3667
URL: https://issues.apache.org/jira/browse/MYFACES-3667
Project: MyFaces Core
Issue Type: Bug
Affects Versions: 2.1.6
Environment: MyFaces 2.1.6, Tomahawk20 1.1.11
Reporter: dennis hoersch
We have set the parameter
'javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL' to tr.
Scenario:
I have a required input field. I type in a value and submit it. Then I remove
the value and try to submit. As expected the validation fails. But now the old
value is rendered again.
The reason is that other parts rendering the input test whether submittedValue
is null and if so render the value.
If the named parameter is true UIInput set the submittedValue to null if is
empty, not only internally during validation method working.
There is a comment in UIInput saying that 'setSubmittedValue(null)' is wrong.
Maybe it is wrong and the line should be removed? If I remove it, the behavior
is as expected and the empty value is rendered.
----
// Begin new JSF 2.0 requirement
(INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL)
if (shouldInterpretEmptyStringSubmittedValuesAsNull(context) &&
isEmptyString(submittedValue))
{
// -= matzew = setSubmittedValue(null) is wrong, see:
//
https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=671
setSubmittedValue(null);
submittedValue = null;
}
// End new JSF 2.0 requirement (INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira