This sounds like it would be far better to do in the plc, but failing that, in a tag change script rather than on a client screen component. This is a gateway/plc scoped function, not a graphical function
Or rather, the range limits should be set appropriately so a user can't enter one outside of the range