I'm migrating from ASP.net validation to the jQuery validation plugin to validate my pages. Is it possible to identify if the controls are valid server-side? ASP.net validation provides page.IsValid
, I am looking for something similar?
Any ideas?
I'm migrating from ASP.net validation to the jQuery validation plugin to validate my pages. Is it possible to identify if the controls are valid server-side? ASP.net validation provides page.IsValid
, I am looking for something similar?
Any ideas?
You may place a flag on an hidden input, and read this value on post back, but this is too riscky, anyone can hack it - and also if some one disable the javascript, your validation is not going to work.
Its better to make again validation on your values on post back (at least this is what I do).
Because javascript is not 100% full-proof (and I can't think of a good reason not to treat all users as malicious), it's always best practice to validate on server-side, even if there is validation on the client-side.
This isn't to say that there's not value in validating forms via javascript (or ajax) for a greater user experience, but these validations should also take place in an environment in which you control.