javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2375

javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL modifies behavior for required fields

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.1.7
    • Fix Version/s: None
    • Component/s: conversion
    • Labels:
      None

      Description

      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)

        Activity

        Hide
        rogerk added a comment -
        Show
        rogerk added a comment - Duplicate of http://java.net/jira/browse/JAVASERVERFACES-1375
        Hide
        rogerk added a comment -
        Show
        rogerk added a comment - Also filed as spec issue: http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-939
        Hide
        vabp added a comment -

        This is a different defect. This defect is that when INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is TRUE, the required field is NOT blanked out, but when set to FALSE it is blanked out. The issue http://java.net/jira/browse/JAVASERVERFACES-1375 has the required field as blanked out when INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is TRUE. This is not happening today. Two separate issues.

        Show
        vabp added a comment - This is a different defect. This defect is that when INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is TRUE, the required field is NOT blanked out, but when set to FALSE it is blanked out. The issue http://java.net/jira/browse/JAVASERVERFACES-1375 has the required field as blanked out when INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is TRUE. This is not happening today. Two separate issues.
        Hide
        rogerk added a comment -

        Reopening per user's comments.

        Show
        rogerk added a comment - Reopening per user's comments.
        Hide
        vabp added a comment - - edited

        This sounds similar to the other defect, however it is different. I'll state the defect 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.

        Show
        vabp added a comment - - edited This sounds similar to the other defect, however it is different. I'll state the defect 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.
        Hide
        Ed Burns added a comment -

        Thank you so much for reporting this. I'll look at it in detail on Wednesday, which is one of the two days of the week when my schedule permits me to work on implementation issues. FWIW, the other days I work on JSF 2.2.

        Show
        Ed Burns added a comment - Thank you so much for reporting this. I'll look at it in detail on Wednesday, which is one of the two days of the week when my schedule permits me to work on implementation issues. FWIW, the other days I work on JSF 2.2.
        Hide
        vabp added a comment -

        @Ed, do you have any update? It's been a month and we're dying because this bug exists in the framework. Any clue when this will be fixed?

        Show
        vabp added a comment - @Ed, do you have any update? It's been a month and we're dying because this bug exists in the framework. Any clue when this will be fixed?
        Hide
        balusc added a comment -
        Show
        balusc added a comment - This also duplicates http://java.net/jira/browse/JAVASERVERFACES-2262
        Hide
        rogerk added a comment -
        Show
        rogerk added a comment - See spec issue: http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-939

          People

          • Assignee:
            Ed Burns
            Reporter:
            vabp
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 days
              3d
              Remaining:
              Remaining Estimate - 3 days
              3d
              Logged:
              Time Spent - Not Specified
              Not Specified