Where do you record validation rules for form data in a web application?

前端 未结 10 1049
广开言路
广开言路 2020-12-24 09:34

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 c

10条回答
  •  醉梦人生
    2020-12-24 09:59

    In the past, I've used XSLT for validation. We'd create an XML doc of the values and run it against XSLT. The XSLT was built of XPath "rules." The resulting XML doc was composed of a list of broken rules and the fields that broke them.

    We were able to:

    1. store the rules in a relational DB
    2. generate the XSLT from the DB
    3. use the XSLT on the client
    4. use the XSLT on the server
    5. use the raw rules in the DB

提交回复
热议问题