Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3667

UIInput renders the old value after required validation error if field is empty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.1.6
    • None
    • None
    • None
    • MyFaces 2.1.6, Tomahawk20 1.1.11

    Description

      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)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hoersch dennis hoersch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: