In both MyFaces and Mojarra 2.1 there is a defect where, when javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
set to true
, any fields marked as required and pre-filled in the model when they are shaded and presented are shown with their original values without attenuation, instead to stay empty.
Scenario:
- The user loads a page with one required field filled with existing data from the model.
- The user deletes the field on the page and submits the form
- The validation failed, as expected, and the user is shown an error message that they must fill in the required field.
The problem is that the field in which what the user sent should be displayed, namely that they sent an empty value for the field, is instead filled with the original value from the model. The only workaround is to set javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
to false
. Setting it to false
provides the desired behavior that the field remains drowned when the page is re-displayed with a mandatory field error message.
The defect was registered with Mojarra (http://java.net/jira/browse/JAVASERVERFACES-2375) and MyFaces (https://issues.apache.org/jira/browse/MYFACES-3525), but no progress was made through 6 weeks.
Please note that it seems that Mojarra had a similar problem, which was reported more than 6 mos ago has not yet been achieved.
Does anyone know of a workaround for this, where we can keep javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
true instead of false and still not run into this required field usability problem?
source share