validator API文档

如何使用

引入

<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../dist/script/ux-form.js"></script>

html

<div class="container">
    <div>
        <label>姓名<input type="text" name="name" /></label>
    </div>
</div>

javascript

var nameFormControl = uxForm.FormControl.create($(‘[name=name]‘), {
    required: true,
    rules: {
        maxLength: 20
    },
    patterns: {
        maxLength: 20
    }
});

nameFormControl.obs.on(‘onCheck‘,function(){
    console.log(nameFormControl.getStatus());
});

https://jsfiddle.net/mqc686cx/4/

validator API文档

上一篇:C#-特性,反射,动态编程


下一篇:C# WPF可拖拽的TabControl