浏览代码

Add more validators to remove demo

nghuuphuoc 12 年之前
父节点
当前提交
37b5d5f490
共有 2 个文件被更改,包括 66 次插入0 次删除
  1. 2 0
      README.md
  2. 64 0
      demo/remote.html

+ 2 - 0
README.md

@@ -253,7 +253,9 @@ Look at the [Change Log](CHANGELOG.md)
 ## Author
 
 Nguyen Huu Phuoc ([Email](mailto: phuoc@huuphuoc.me) / [Twitter](http://twitter.com/nghuuphuoc) / [Github](http://github.com/nghuuphuoc))
+
 Vu Minh Khang ([Github](https://github.com/khangvm53))
+
 ## License
 
 Copyright (c) 2013 Nguyen Huu Phuoc

+ 64 - 0
demo/remote.html

@@ -36,6 +36,34 @@
                         </div>
 
                         <div class="form-group">
+                            <label class="col-lg-3 control-label">Password</label>
+                            <div class="col-lg-5">
+                                <input type="password" class="form-control" name="password" />
+                            </div>
+                        </div>
+
+                        <div class="form-group">
+                            <label class="col-lg-3 control-label">Retype password</label>
+                            <div class="col-lg-5">
+                                <input type="password" class="form-control" name="confirmPassword" />
+                            </div>
+                        </div>
+
+                        <div class="form-group">
+                            <label class="col-lg-3 control-label">Website</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="website" placeholder="http://" />
+                            </div>
+                        </div>
+
+                        <div class="form-group">
+                            <label class="col-lg-3 control-label">Phone number</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="phoneNumber" />
+                            </div>
+                        </div>
+
+                        <div class="form-group">
                             <div class="col-lg-9 col-lg-offset-3">
                                 <button type="submit" class="btn btn-primary">Submit</button>
                             </div>
@@ -77,6 +105,42 @@ $(document).ready(function() {
                         message: 'The email is not available'
                     }
                 }
+            },
+            password: {
+                validators: {
+                    notEmpty: {
+                        message: 'The password is required and can\'t be empty'
+                    },
+                    identical: {
+                        field: 'confirmPassword',
+                        message: 'The password and its confirm are not the same'
+                    }
+                }
+            },
+            confirmPassword: {
+                validators: {
+                    notEmpty: {
+                        message: 'The confirm password is required and can\'t be empty'
+                    },
+                    identical: {
+                        field: 'password',
+                        message: 'The password and its confirm are not the same'
+                    }
+                }
+            },
+            website: {
+                validators: {
+                    uri: {
+                        message: 'The input is not a valid URL'
+                    }
+                }
+            },
+            phoneNumber: {
+                validators: {
+                    digits: {
+                        message: 'The value can contain only digits'
+                    }
+                }
             }
         }
     });