[ 
https://issues.apache.org/jira/browse/MYFACES-3525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319117#comment-16319117
 ] 

Thomas Andraschko edited comment on MYFACES-3525 at 1/9/18 9:02 PM:
--------------------------------------------------------------------

First of all, we should decide what we do...
The JSF (Mojarra 2.3) behavior is that the value is ALWAYS cleared. For this 
feature, the patch seems to complicated for me. Should be simple IF-statement?!

If we would like to create a behavior, that the value is displayed from the 
model again, then we need a context param, too. But the default should be: 
clear always if validation fails.

EDIT: nvm, i never read in the comments here that someone would like to 
redisplay the old model value. So the patch is actually ok but i would do a 
cleanup, we don't need that overhead in 2.3. with additional methods and 
context params.


was (Author: tandraschko):
First of all, we should decide what we do...
The JSF (Mojarra 2.3) behavior is that the value is ALWAYS cleared. For this 
feature, the patch seems to complicated for me. Should be simple IF-statement?!

If we would like to create a behavior, that the value is displayed from the 
model again, then we need a context param, too. But the default should be: 
clear always if validation fails.

> javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL value affects 
> display behavior for required fields
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3525
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3525
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.0.12, 2.1.18, 2.2.12, 2.3.0-beta
>            Reporter: VS
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.25-SNAPSHOT, 2.1.19-SNAPSHOT, 2.2.13-SNAPSHOT, 2.3.0
>
>         Attachments: MYFACES-3525-JSF23.patch, 
> MYFACES-3525-setsubmittedValueagain.patch, MYFACES-3525.patch
>
>
> Inconsistent behavior for required field validation when 
> javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is set to true 
> versus false
> To observe behavior:
> 1. Set javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL to true in 
> web.xml
> 2. Create JSF Page:
> <h:form>
> <h:messages showSummary="true"/>
> <h:inputText value="#{page1Controller.firstName}"
> required="true"
> requiredMessage="You must enter a first name"/>
> <h:commandButton value="Submit"/>
> </h:form>
> 3. Create Managed Bean:
> @ManagedBean
> public class Page1Controller
> {
> public String getFirstName()
> { return "Default Value"; }
> public void setFirstName(String value)
> { // no-op (for example purposes only) }
> 4. Load JSF page, blank out value in the input field and click Submit
> 5. Error message is displayed, however the value in the input field (which 
> you formerly blanked out) is now reset back to its original value.
> 6. Change the javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL 
> setting to false and re-run the test.
> 7. Note that the value in the input field remains blank.
> Behavior is inconsistent and should be fixed 
> (javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL setting of true 
> or false should not result in inconsistent behavior with required fields)
> ----
> To state in a different way:
> When INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is TRUE, and you blank 
> out a value for a required field that had previously been populated by the 
> model, submit the form, you will see the OLD data from the model in the 
> field. However, if that field had had a format validation applied to it and 
> the user submits the form with a format validation error, the OLD data is NOT 
> shown in the field (instead, the submitted/invalid data is shown). The same 
> should happen for required field validation errors. The field should show the 
> "blank" data and not the original model data. In order to get the correct 
> behavior, the developer has to currently set 
> INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL to false. But they should not 
> have to do this... whether INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is 
> true or false, the behavior of showing the blank field that the user 
> submitted should be the same.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to