JSAN and Form.Validator
大致上是我第一次用 JSAN. JSAN 的意思是 "CPAN".replace(/CP/, "JS") 它的目标是成为类似 CPAN 一样的 JS 库。 CPAN 是每个 Perl hacker 的骄傲。不过 JSAN 目前的东西不是很多。
我用的是 Form.Validator, 检验 form 输入的东西。不过 JSAN 这个模块的命令似乎在 Win32 下跑不起来。只好一个个去下。
http://www.openjsan.org/doc/c/cw/cwest/JSAN/0.10/
http://www.openjsan.org/doc/b/be/beppu/Form/Validator/0.33/index.html
下回来。目录的结果大致为:
have fun.
我用的是 Form.Validator, 检验 form 输入的东西。不过 JSAN 这个模块的命令似乎在 Win32 下跑不起来。只好一个个去下。
http://www.openjsan.org/doc/c/cw/cwest/JSAN/0.10/
http://www.openjsan.org/doc/b/be/beppu/Form/Validator/0.33/index.html
下回来。目录的结果大致为:
JSAN.js根据 http://www.openjsan.org/doc/b/be/beppu/Form/Validator/0.33/lib/Form/Validator.html 这里的说法写 HTML 文件。大致为:
Form/Validator.js
Form/Validator/*
<script src='/js/JSAN.js'></script>
<form name="stuff" ...
<script>
JSAN.use('Form.Validator');
JSAN.use('Form.Validator.Report.AlertAll');
fv = new Form.Validator(document.stuff);
fv.reporter('AlertAll'); // show a pop-up with all errors
fv.set('title', 'notBlank', "Title is required.");
fv.set('text', fv.makeValueMin(5), "Text must be 5 or greater.");
</script>
have fun.
0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home