How to show validation messages in MVC?

Posted by Ian Boyd on Stack Overflow See other posts from Stack Overflow or by Ian Boyd
Published on 2010-03-17T19:54:59Z Indexed on 2010/03/17 20:01 UTC
Read the original article Hit count: 497

When a user tries to click:

       Save

and they have entered in some invalid data, i want to notify them. This can be with methods such as:

  • directing their attention to the thing that needs their attention with a balloon hint
  • automatically dropping down a combo-box
  • triggering an animation
  • showing a modal dialog box
  • etc

What is the mechanism where a controller tells the view to show a validation message for some controls, given that different views have different notification methods?

p.s. the controller doesn't know the order that controls are physically arranged in the view (e.g. LTR locale wants to notify the user in a top-down-left-to-right visual order, while RTL locale wants to notify the user in a bottom-up-right-to-left order)

© Stack Overflow or respective owner

Related posts about mvc

Related posts about best-practices