Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 57833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:45:11+00:00 2026-05-10T17:45:11+00:00

Say you have a web form with some fields that you want to validate

  • 0

Say you have a web form with some fields that you want to validate to be only some subset of alphanumeric, a minimum or maximum length etc.

You can validate in the client with javascript, you can post the data back to the server and report back to the user, either via ajax or not. You could have the validation rules in the database and push back error messages to the user that way.

Or any combination of all of the above.

If you want a single place to keep validation rules for web application user data that persist to a database, what are some best practices, patterns or general good advice for doing so?

[edit]

I have edited the question title to better reflect my actual question! Some great answers so far btw.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:45:12+00:00Added an answer on May 10, 2026 at 5:45 pm

    all of the above:

    1. client-side validation is more convenient for the user
    2. but you can’t trust the client so the code-behind should also validate
    3. similarly the database can’t trust that you validated so validate there too

    EDIT: i see that you’ve edited the question to ask for a single point of specification for validation rules. This is called a ‘Data Dictionary’ (DD), and is a Good Thing to have and use to generate validation rules in the different layers. Most systems don’t, however, so don’t feel bad if you never get around to building such a thing 😉

    One possible/simple design for a DD for a modern 3-tier system might just include – along with the usual max-size/min-size/datatype info – a Javascript expression/function field, C# assembly/class/method field(s), and a sql expression field. The javascript could be slotted into the client-side validation, the C# info could be used for a reflection load/call for server-side validation, and the sql expression could be used for database validation.

    But while this is all good in theory, I don’t know of any real-world systems that actually do this in practice [though it ‘sounds’ like a Good Idea].

    If you do, let us know how it goes!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The DTO's provide an abstraction layer for your domain model.… May 11, 2026 at 12:39 pm
  • added an answer PreRender is the event that takes place just before the… May 11, 2026 at 12:39 pm
  • added an answer If you are using A*, but have multiple vertexes in… May 11, 2026 at 12:39 pm

Related Questions

When creating a web application, and lets say you have a User object denoting
Let's say you have a typical web app and with a file configuration.whatever. Every
I have a Web Application project in Visual Studio 2008. (lucky you, you say?
Say you have a shipment. It needs to go from point A to point
I'm working on a web application (with ASP.NET 2.0 (C#) and jQuery) In my
I want to accomplish the following scenario in Drupal: You have 2 content-types. Lets
Do you know about a library that allows us to generate UI by just
Say you have something like an ASP.NET ASP:DetailsView to show and edit a single

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.