04-27-2013 09:59 PM
I'm sure this question has been asked before, but I couldn't find the magic search words to locate it. When the user changes the value of a control (let's just say a numeric control, but the same question applies to pretty much any editable control), I need to check the value they entered and determine if it's acceptable. If it's not, I'm going to put up a message. I'd also like to rollback the control to the original value. Is there some easy way to do this without having to save the control value in a static variable, then restoring it manually?
Tony G.
04-29-2013 12:05 AM
Perhaps this help page on control events can help you a bit in designing your app.
The easiest solution for numeric controls is to set a range either in the UIR editor or programmatically (SetCtrlAttribute with ATTR_MIN_VALUE and ATTR_MAX_VALUE attributes) and set it in coerce mode, so that if the user enters a value out of range, it is clipped to the nearest limit and a EVENT_VAL_COERCED is sent to the control callback.
Alternatively you can set the control in Notify mode so that an alert sign is visible and use ValidatePanel to check if all controls are in-range or not.