Skip to content

DynamicForm Numeric Up/Down buttons not working #1956

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

Open
IRRDC opened this issue Feb 27, 2025 · 0 comments
Open

DynamicForm Numeric Up/Down buttons not working #1956

IRRDC opened this issue Feb 27, 2025 · 0 comments

Comments

@IRRDC
Copy link
Contributor

IRRDC commented Feb 27, 2025

Category

[ ] Enhancement

[X] Bug

[ ] Question

Version

Please specify what version of the library you are using: [3.20.0]

Expected / Desired Behavior / Question

The up/down buttons of numeric fields should increment or decrease the entered value.

Observed Behavior

When there is no limit for the values of the numeric column, SharePoint returns very large values for min and max (I guess max float) which cause the numeric up down buttons in the DynamicForm to stop functioning. If there is no value, clicking one of them will enter 0 in the textbox. Further clicks (or starting with a manually entered value) will not change the number. It is still possible to change the value by typing.

I fixed the issue by adding an additional check for the values, reducing it to MIN/MAX_SAFE_INTEGER in DynamicForm.tsx:

minimumValue: minValue ? (minValue < Number.MIN_SAFE_INTEGER ? Number.MIN_SAFE_INTEGER : minValue) : undefined,
maximumValue: maxValue ? (maxValue > Number.MAX_SAFE_INTEGER ? Number.MAX_SAFE_INTEGER : maxValue) : undefined,

The values get rendered by DynamicField.tsx which already contains this check:

let minValue = minimumValue !== undefined && minimumValue !== -(Number.MAX_VALUE) ? minimumValue : undefined;
let maxValue = maximumValue !== undefined && maximumValue !== Number.MAX_VALUE ? maximumValue : undefined;

So it might be a better solution to fix the DynamicField instead of the DynamicForm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant