Test if value is valid before setting raw value