1

我一直在寻找,似乎还没有人破解这个问题,但我想我也会问这里的社区,看看有没有什么问题。

有没有办法让客户端验证(jQuery、实时验证等)自动从 LLBLGen 的内置验证中获取验证规则?

LLBLGen(和 Subsonic 等其他人)已经知道字段不能为空,必须少于 100 个字符等,并且不必在所有地方都设置这些似乎很有用。

4

3 回答 3

2

Check out xVal... it generates jQuery Validation based on validation found in your models.

xVal @ CodePlex

Introduction to xVal blog post

I don't know how LLBL validation works or if there is any native support for it in xVal. But if there isn't, it would just be a matter of creating an IRulesProvider - no doubt it would come in handy to numerous other LLBL users.

I think something similar was done for the LightSpeed ORM. See here MVC and LightSpeed – Part 4 – Model Binding

于 2009-04-13T22:25:34.787 回答
0

Jquery.Validate is pretty awsome. It can validate credit card numbers, dates, min and max characters, and many other features. The link is here and it is very simple to use.

http://docs.jquery.com/Plugins/Validation

Basically all you do is register the .js file when loading up your page and when declaring the class of an input, put in "validate" or "validate date" or whatever and it will intelligently do it for you. Again they give examples and documentation in the link. Hope this helps you.

于 2009-04-13T14:14:57.633 回答
0

我想说必须创建适当的模板来输出您想要的任何验证代码(或修改现有的)。我不确定是否有任何现有的,但您可以自己创建它们 - 这很容易。

高温高压

于 2009-04-13T14:22:04.887 回答