I'm working on a desktop application that has text fields and other form elements scattered on various pages. A global save button saves all inputs from all pages. Since the textfield format/error validation is global and I don't have the option the validate on save I have to make sure that the input is correct when the user clicks "save".

Now I was wondering what the ideal textfield validation would be in terms of user experience and data integrity.

It comes down to 4 options:

  • Error persistence: just save the values as they come to the database.

    • -> At some point the errors would have to be corrected by the user. I would prefer this option. Problem is, this isn't supported by my data model and would mean high implementation effort.
  • Auto-Correct: E.g. Show error feedback but delete invalid characters automatically after the focus ist lost.

    • -> The auto-corrected value is not necessarily correct. The user might not notice both the error notification and auto correction and a false value is saved.
  • Ignore invalid characters: Ignore keystrokes of invalid characters but show a baloon notification with a hint that the character is not allowed.

    • -> Again, the user might not notice the baloon or the altered value while typing (not looking at the screen maybe) and a false value is saved.
  • Delete invalid input: Show error feedback, but delete the input after the focus is lost.

    • -> This forces the user to re-enter the data from the start. Not very elegant, especially not for longer values.
  • How many pages are there?
    – Mervin
    Sep 25, 2014 at 17:37

3 Answers 3


Ignore invalid character is the best option. The user is typing that entry when you are making the change so it by far the most likely to be noticed. If you do it when the focus changes, it is much more likely to be ignored.

What do you mean error persistence? Is there an option not to persist the input in the database until after they save? If this an option and you expect the user to try invalid input, the ideal solution is to leave it incorrect but block saving until it is fixed.

  • Blocking save is not really an option. Being able to close the application and save quickly is a requirement. So I have to make sure the data is processable before saving.
    – J_rgen
    Sep 26, 2014 at 9:54
  • What kind of input is it? If the special character are truly never valid just ignore them, but if it is something like name or address where "invalid" could still be valid, it might take a better solution.
    – tony
    Sep 26, 2014 at 15:11

If you are validating the input in real-time, you can call the user's attention to it (similar to your suggestion in Option 3) by highlighting the field (red borders, big arrows, flashing lights, etc) and explaining why (via tool-tip or word balloon). If your users frequently aren't looking at the screen while typing, you could also sound an alert, though I wouldn't do that until I was sure it was absolutely necessary.

To prevent erroneous data in your data store, though, you should probably supplement any error detection with disabling the Save button when you've detected an error. That, plus an informative error message near the button ("There are errors in the data you have entered. You must correct it before saving.") will prevent the bad data and inform the user about the problem.

  • Notification sounds are pretty much obsolete nowadays. I would not go so far and sound a 'ding' when an error is made, that would get annoying very quickly. Other than that, I think a lot of my user have their sound turned off.
    – J_rgen
    Sep 26, 2014 at 9:35

You may like error persistence but a data model that must to support invalid data is problematic at best.

What if you had a date validation and date column in the database?
If it was not a valid date period you could not even persist it to date column in SQL.

Why did you let them enter an invalid character in the first place?
Don't accept the value and give them feedback the value was declined.

Ignore invalid
Same thing - if they are invalid then why are they there in the first place

Delete invalid
Why are you waiting for lost focus to delete?
Why are invalid character accepted in the first place?

  • By "Ignore invalid" I meant that the value IS declined. So I believe the 3rd option would be you pick then?
    – J_rgen
    Sep 26, 2014 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.