0

I am working on a form, which I would like to validation features like This. Should this all be done on clientside? or server side? I am aware of using some of MS ajax controld, however, at what point do I display the message at the top?

I hope I explained myself.

5 Answers 5

3

You should validate at both ends.

  • Client side to make sure feedback is immediate so users can complete it fast (a bonus for them) and you save server resources (bonus for you).

  • Server side to make sure that any user-agents not using JS can check the incoming data. This is essential to stop malicious/corrupt data entering your system.

If you were only going to do one, make it server side, but there are considerable benefits to the user by implementing a dual-system.

Sign up to request clarification or add additional context in comments.

Comments

0

validation on the client-side and provide feedback when they click the submit button

but since you cannot trust client-side validation, also validation on the server side and display feedback on postback if everything is not correct

but since you cannot trust the calling code, also validate in the database server (stored procedures are best) and raise errors back to the calling code if something is amiss

that way you've covered all the bases

Comments

0

It's generally considered a good practice to validate on both the client side and the server side...just in case someone attempts to directly submit a form POST without actually loading a page.

As far as when to display the validation message, it is something of a personal preference. I tend to perfer giving feedback as soon as possible, so I would do things like regex validation when the field looses focus.

Comments

0

Its really easy, you can use the ASP.NET Validation controls, you can use them in both, client and server side.

Check this resources:

1 Comment

Can I interact with the validations controls, i.e. catching the error event and then displaying my error message at the top?
0

In general terms (depending upon the quality of your Ajax Framework) client-side validation is out. It's a relic from the past (Pre Ajax Times) and not really needed anymore...

Run all your validation on the server. After all with Ajax everything is 100 times as fast anyway, right...?

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.