-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[Bug]: ValidationTypes.Number returning 'min' value (when min value validation is set) instead of the parsed value #17472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@riodeuno can you help me a bit here? Wondering if this is expected? Or should we go about identifying how to make the change? |
The rationale behind having min and max here, is that the values beyond the bounds would break the application or have the widget work incorrectly. This is why the fallback is the I have been thinking about a facility to have the value simply Tentative thought: Alternatively, if we're confident in all our widgets, we can remove all validation safety mechanisms, and have the value always passthrough as parsed value. |
@riodeuno the validation logic of min of Number validation already return { isValid: false, parsed: parsed || config.params.min || 0, messages: [`Minimum allowed value: ${config.params.min}`], }; When the parsed value is 0 it returns the min value. but for all other values, it returns the parsed value. |
@aswathkk @rohitagarwal88 Could you help us out ? |
As @sbalaji1192 mentioned, the passthrough behaviour won't work if the value is 0. In those cases, the returned value becomes the min value provided in the configuration. The way to fix this behaviour is to change
We need to handle this in such a way that the behaviour of these properties is maintained. May be like @riodeuno told, we can introduce a boolean parameter called |
@sbalaji1192 Yeah. Then this parameter should be there only for NUMBER type validation. Let's do it like that then. |
as discussed with @aswathkk ,this cannot be tested . However, just tested the existing functionality. seems fine |
Is there an existing issue for this?
Description
When the 'min' value validation is set, eg:
validation: { type: ValidationTypes.NUMBER, params: { min: 1 }, }
The expected value is supposed to be the parsed value.
However, what is being returned is the minimum value.
Steps To Reproduce
validation: { type: ValidationTypes.NUMBER, params: { min: 1}, }
Public Sample App
No response
Version
Cloud - 1.8.5
The text was updated successfully, but these errors were encountered: