When the user leaves a textbox control I want to trim any spaces and immediately update the display with the tidied string.
Should this be done in the Leave, Validating or Validated event?
Thanks
Clarence
When the user leaves a textbox control I want to trim any spaces and immediately update the display with the tidied string.
Should this be done in the Leave, Validating or Validated event?
Thanks
Clarence
onBlur = when the user leaves.
But the user could also submit the form without leaving the tb, e.g., by hitting the enter key. So you may also want to listen for that.
The Leave event would be best suited, as it occurs when the focus has left the textbox.
I would use leave if you simply want to trim the string. Validating is useful if you want to cancel the leave (from tab, enter click etc) and keep the textbox selected.