validate value and reset to old value if invalid