myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Yvanovich (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (TRINIDAD-2064) UIXEditableValue.compareValues() shouldn't return false for 'empty' strings of different lengths
Date Wed, 16 Mar 2011 23:54:29 GMT
UIXEditableValue.compareValues() shouldn't return false for 'empty' strings of different lengths
------------------------------------------------------------------------------------------------

                 Key: TRINIDAD-2064
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2064
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 2.0.0-beta-2
         Environment: Any
            Reporter: Mark Yvanovich
            Priority: Minor


In UIXEditableValue.validate(), UIXEditableValue.compareValues() is called to check to see
if the value has changed.  Currently, if the previous value and the new value are both empty
(i.e. whitespace) compareValues() returns false to indicate they are the same.  This, however,
is not really correct.  If you enter the value " " (one space) and then later try to change
it to "  " (two spaces) or "" (no spaces), the new value will be ignored because compareValues()
says that the two values are the same.

This can be reproduced on the inputText tag demo page.  Select the contents of the inputText
and type in a " " (one space) to replace the current value and hit submit.  Then, try to update
the value to "  " (two spaces).  If you look at the value attribute in the table below with
firebug, you'll see that the value doesn't get updated.  When using an inputText as a filter
field, filtering by " " (one space) or "  " (two spaces) can have different results.  For
this reason, we should allow for the value to be changed.

Basically, the logic should be that if the two values are empty (I.E. UIXEditableValue.isEmpty()
returns true for both values) then we should check the lengths to see if they are in fact
different.  The one condition that we need to preserve is that null and "" (no spaces, the
real empty string) should compare as the same (so compareValues() should return false for
this case).

The current work around is that you have to submit a non-empty value and then submit the desired
new empty value (i.e. two spaces or no spaces, etc).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message