Does anyone use a standard class or function to provide validation in their apps?
In a previous app I wrote a validation function that took parameters of the value to validate, the max length it could be, whether it was required and a code to use a specific regex pattern to validate.
So, I could reuse this function on all form controls to validate the content. My preference is to have an "error display box" on the page that is used to display any validation errors on a sequential, singular basis. For example, suppose you had the following page:-
If textbox1 is left blank and textbox2 contains 123456, all I want to show is that texbox1 must be completed. I think it makes it more confusing for the user if they have a whole list of validation errors to complete.Code:<asp:panel id="pnlError" runat="server"> </asp:panel> <asp:textbox id="textbox1" runat="server" /> //This element is required <asp:textbox id="textbox2" runat="server" /> //This element can only accept [a-z]
I don't know if this is a particularly good or acceptable method of validating?
I know .NET provides validation controls. Does anyone just use these or do you have a standard function that you reuse in apps?
What method(s) do you guys tend to use?
btw, I know about providing client side and server side validation. I'm referring just to server side here.



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks