I've been reading through some of the other questions tagged with validation and similar. We have a Windows desktop application (WPF) that has many textboxes contained in a dialog that need to be validated, each one differently (needs to be a number, needs to be between 2 numbers, needs to be greater than zero, etc.).

We can't use the same UI that most website forms use when you try to Submit or move to another page, where some text is displayed (in red, for example) near the invalid fields, indicating both which fields are invalid and what is the expected input/what is wrong with the current input. In such cases, the height of the webpage is just extended to accommodate the additional text, if needed.

In our application's case, real estate is limited, so the controls and window cannot be easily resized. The question is, what are some rules/no-no's on validating the input during user interaction?

Do we change the values from incorrect ones to a default correct one? If so, when — on field exit, on dialog OK, or…? Tooltips seems to be a viable communication method.

  • 3
    What kind of application? WPF has great validation. In that case the border changes to read and you can have a tooltip. Even if you don't use WPF it is a behavior many users are used to.
    – paparazzo
    Oct 20, 2014 at 21:11
  • Yes, it's a WPF application. Any good reads/sources on WPF validation? I guess I'm looking for how to manipulate the user a little bit, not just visualization. By that I mean, I don't want to let the user OK the dialog with invalid stuff. Do I make all the invalid textboxes red and show all the tooltips at one time? Oct 20, 2014 at 21:43
  • Is it possible for your application to validate data on entry (eg: keydown/up/press events)? Then, if data fails validation, hide/disable the 'OK' button and make the invalid fields red (border and text colour) and show one or more warning(s). Otherwise, keep the 'OK' button displayed/enabled. Dec 12, 2014 at 20:10

4 Answers 4


To your main question...

Big No-No's around validation:

Automatically changing a value You should be notifying a user that a potential issue / mistake was made and suggest the right answer if you are able to do so.

In a case where there is a dependency between fields and if changing the value forces another field to update, again notify the user about the change to a previous field they filled out.

Not covering all use cases or misleading content/labels

If you are validating a field, make sure all use cases are covered. I've seen a lot of websites where field labels / notes ask for one thing but validation is very limited. Example: "Enter your email address", but validation only expects email addresses that end with ".com", ".net" and ".org"

Or... "Provide your IP address" but only allow IPv4 address and not IPv6

Not helpful tooltips

Visually change the styling of the field and not displaying any helpful text. Main issue here is with accessibility as some people may not even notice a color change.

Other common mistake is ... displaying the text "invalid value" or similar. This will keep the user guessing what they did wrong and that could get very frustrating.

Clearing values on error (Not saving form state)

Let me say that the larger the form it the less your conversion rate will be, forms should be small / short and only capture additional information you have not captured yet. Users are most likely to provide short pieces of the info.

Now, I've seen some older websites that don't save form state after an error occurs and forcing the user to re-enter information again. Save form state to help your form conversion.

Disabling action buttons

I've seen cases where "Submit" button is disabled until all fields pass validation. It may sound like a good idea at first, but you don't want your user to keep guessing why the button does not work and what they may be missing. It's ok to disable the button after initial submit and while the errors are shown (assumption that field validation happens on "keyup" so as soon as the last field passes validation - the button reactivates instantly).


Look this tutorial for validation rules: http://wpftutorial.net/DataValidation.html

The error message is inside the tooltip, but you can put the error message in a storyboard and animate it. Like showing up only, if an error occured. This is how inline validation is used at websites. Don't ask me how I did it. It's some years ago, but feasible. I think something like start animation if string box isn't empty. Hope it helps.

I miss the time, working with Sketchflow and Expression Blend - it's a great toolset..


WPF has a great Validation framework. I find it to be intuitive with many options. And it conserves screen space. It uses borders and optional tool tips.

Programming is not that easy but it is nice for programmers as it enforces rules at the data layer. The business / data layers does not have to care how enforcement of those rules bubble to the UI layer.

Many users are used to it. To me anything Microsoft does is a standard.


If you bind an Integer property to TextBox you automatically get integer validation.
In fact you need a converter for an empty TextBox to not send string.empty.

As for when do you coerce the value to a valid one?

  • Start with a valid / default values
  • Cannot do it on key down as > 10 would fail before they hit the second key
  • Lost focus - when they leave the TextBox
  • Lost focus or enter key
  • When you click a submit / process button
  • Don't coerce. Give the user feedback as to what is wrong / acceptable and make them enter a valid value.

They all have plus and minus

If you coerce a value that is based on other values you can get into a loop problem if you set it on lost focus.

  • None of this post actually answers the question asked. "Do we change the values from incorrect ones to a default correct one?" All you have done is say 'do what microsoft do' but then not actually explained what that is and why it is appropriate. (Adding a link and expecting everyone to click through to it and find the answer themselves doesn't really qualify as an answer in its own right, it's just a link).
    – JonW
    Oct 21, 2014 at 13:09
  • We try to utilize as much of the Microsoft conventions and UX guidelines (a hefty document). What is unique for us is that we are a CAD/CAM software that must validate the input, otherwise the rest of the processing and calculations will simply crash the application. By validate, I mean sometimes it must be a number (vs. text). Sometimes it must be a number in a certain range. Sometimes it must be a number with certain relationship to another input (> 50%). So the question still remains, do we automatically change the input to a valid value? Is that acceptable/expected in good UI? Oct 21, 2014 at 13:20
  • @JonW There is a lot more than a link on that answer and this is a UX question. You are correct I did not address should you change it - just an infrastructure for changing and user feedback.
    – paparazzo
    Oct 21, 2014 at 13:28
  • It is a UX question, but this is not a UX answer. You have not detailed the User Experience that would be present. You have only included comment that WPF is nice for programmers (which is irrelevant to this UX question) and then given some implementation advice (which is off topic for this UX stack exchange site) and have included a link; but not stated what part of that link is relevant, or why.
    – JonW
    Oct 21, 2014 at 13:36
  • @JonW It is just a general link to Microsoft Validation. Read the second comment on the question. "Any good reads/sources on WPF validation?" In the first comment I stated Validation uses border and tool tips. I will add it to the answer.
    – paparazzo
    Oct 21, 2014 at 13:42

WPF validation can be set up to highlight/tooltip-explain bad fields when they lose focus; that way the user's complete input is available. You can leave OK/Save disabled until all fields validate successfully, but a better approach (in cases where most/all fields start out blank and a user might forget to fill in one that's required) is to have the button enabled, but to validate all blank fields when it's clicked and only close if they pass, putting up the highlight on those that fail as normal. This way, you don't have the problem of displaying an irritating highlight on fields the user hasn't gotten to.

Alternatively, of course, leave the OK button disabled until all required fields are valid and non-blank, but only put up the validation highlight/tooltip once they've been focused at least once.

Silently correcting user input is not a best practice in most cases, as it tends to keep users from correctly entering what they wanted. And if you start with a reasonable default in the field, any changes should be assumed to be intentional, and so if invalid need correcting by the user. An exception to this, though, would be cases where an empty field is invalid by itself, but can be extrapolated to a reasonable default, in which case faded-out and/or italicized text within to indicate the default is useful. For example, a number of network-dependent applications like IM or torrent clients use stunserver.org as their default STUN/TURN server, and indicate this in configuration with a blank textbox that can be set if desired, but that falls back to the default when blank, and which displays the default as an example setting as noted.

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.