How to provide warnings during validation in ASP.NET MVC?

后端 未结 5 2025
我寻月下人不归
我寻月下人不归 2020-12-12 20:52

Sometimes user input is not strictly invalid but can be considered problematic.

For example:

  • A user enters a long sentence in a single-line Name<
5条回答
  •  无人及你
    2020-12-12 21:25

    Just a quick comment on the possible re-submit implementation you mentioned...

    For the "did you mean to do this?" validation type, from a user's perspective, having to re-submit a form based off an assumption that they made a mistake could be very annoying. I would only implement this 'pseudo-validation' on the client side with javascript and (hopefully quick) ajax calls if you have to hit the server.

    I would also attempt to display the warnings on the input's blur/change events so they show before the user hits submit. Maybe not practical in all situations, but I just thought i'd throw it out there.

提交回复
热议问题