Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    IntegerItem incorrectly accepts and normalizes percentage input (e.g. 100% becomes 1)

    Hello Isomorphic team,

    We would like to report what appears to be an unexpected input parsing issue when using SmartGWT IntegerItem.

    Summary
    • IntegerItem accepts percentage-formatted input (e.g. 100%, 200%) and normalizes it to an integer value (1, 2), even when integer-only validation is applied.
    • SmartGWT documentation for IntegerItem does not mention percentage handling or normalization.
    • This can lead to incorrect persisted values without any user-facing error.
    Environment
    • SmartClient Version: v12.1p_2021-07-14/PowerEdition Deployment (built 2021-07-14)
    • Mode: SuperDev
    • Browser: Chrome Version 146.0.7680.178 (Official Build) (64-bit)
    • OS: Windows 11

    Steps to Reproduce
    1. Create a form field using IntegerItem
    2. Instantiate IsIntegerValidator() and setErrorMessage()
    3. Set IsIntegerValidator() to IntegerItem field
    4. Enter a value containing a percent sign, for example: 200%
    5. Save or read back the value
    Expected Result Actual Result
    Percentage-formatted values should be rejected Input is accept
    Display error message 200% is normalized to 2
    Code:
    IntegerItem randomSamplingIntegerItem = new IntegerItem("randomSampling");
    
    IsIntegerValidator integerValidator = new IsIntegerValidator();
    integerValidator.setErrorMessage("An integer must be entered");
    
    randomSamplingIntegerItem.setValidators(integerValidator);

    Scope
    • We verified that this behavior is not isolated to a single screen and occurs consistently across multiple IntegerItem fields within our application.
    Questions
    1. Is percentage parsing and normalization considered intended behavior for IntegerItem?
    2. If not, is this a known issue or bug?
    3. What is the recommended approach to enforce strict integer-only input (disallowing % and other locale-based numeric formats)?
    Thank you for taking a look.
Working...
X