How to prevent "invalid" data in a DB field (e.g., via numeric control)
I have a pcclasslevel control (numeric) and the setting of the DB value triggers onValueChanged() which then calls a "calculate level based stuff method"
I also have a max level checking method that checks max allowed level for a class as well as for a race/class combo. If I wanted to hard limit the pclassLevel to the max level for a class (regardless of race) - how do I do that?
I do not want to use the min/max values in xml for this as they are not static. I COULD set them whenever the pcclass field changes and call setMaxValue() on pcclasslevel from there. I believe that would work.
But, ideally, I'd like to have a "reject change" type check. When I have Fighter, Human, 10 and drag Fighter on top of class - it should reject upping it to 11. Currently, I have this. BUT if someone types "11" in the Level field, it takes it. If I add the check to reset to 10 in that onValueChanged for Level, it would be a recursive skip. I do not see a "onAboutToChangeValue" or "onValueSubmitted" method - so I guess I need to do the setMax whenever class is set?
I figure this "validation" issue is common enough many of you have thought about it and done it.