Number entry: is there a way to trap the up/down arrow buttons?

If the user clicks either of the embedded buttons, the “change” event doesn’t trigger.

What I’m trying to accomplish: simplifying the entering of valid data. When I have a number field, I (usually) know its minimum and maximum valid values. When the field is blank,

  • clicking the up button should result in the minimum valid value.
  • clicking the down button should result in the maximum valid value.

If I could catch the button clicks, when they happen, then I could force the value into the proper range immediately. If there are any “reserved” or “already used” values, then I could skip over them.

I find it is far better to prevent invalid entries in the first place, than to chastise users afterwards for not knowing better.

Have you evere found solution for this p.colbert ?

Nothing so far. It might be possible to build a custom component using JavaScript, but that’s beyond my current level of study.

The best I was able to do was to use the “lost_focus” event, which is triggered as keyboard focus is shifting out of the TextBox to somewhere else. At this point in time, it is fair to assume that the value in the TextBox is complete. (It’s rare for me to exit the field halfway through typing its value – but when I’m interrupted, sometimes I must.)

1 Like