Copy link to clipboard
Copied
I need to set the Maximum so that the use can use the mouse to change the value of numericstepper (and not go over a certain number), but at the same time I have to allow the user to enter their value by typing in the text field. When the user enters a number greater than the Maximum, I disable the "Ok" button of the dialog and show a red warning(error message). The issue is that the user can hit "Enter" and numeric stepper would set the value to the Maximum and the dialog box would close and the rest of code would run. I want the numericstepper not to change the value and keep showing the warning even if the user hits the "Enter".
Note: Setting maxChar does not help since my maximum is 1000, and user might enter 5555
I would appreciate the help.
Copy link to clipboard
Copied
store the previous valid stepper value
assign the max stepper value 1 greater than the real max you want to use (assuming integer values)
and use a change event to detect when the user changes your stepper.
if it's changed to a value greater than the real max, reset its value to the previous value.
Copy link to clipboard
Copied
Thanks for trying to help, But
The issue is that if I set the maximum value of stepper 1 greater than the max value that I want, then the user can select an invalid value(of myMax + 1) when he clicks on the UP arrow of the numeric stepper(which is not acceptable for what I am working on).
I need to preserve the users invalid number, while not letting the user to select an invalid number by clicking UP key.
I noticed that when the user enters a number greater than the Maximum, and then click on the down arrow, it would set the value to 1 less than the maximum. This is not acceptable either.
Copy link to clipboard
Copied
use the change event to detect if a user has incremented beyond your desired max and reset its value.
Copy link to clipboard
Copied
The issue with that solution is that when the user "Types" the number that is equal to desiredMax + 1, it will reset the value to the desiredMax. As I mentioned earlier, I need to keep the invalid number and show a warning.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now