Added <https://wzrd.in/> example.
This commit is contained in:
parent
b1b3fdcce8
commit
3185b12083
|
@ -200,9 +200,13 @@ schema.properties.notIn = function(value, badwords)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Browser usage
|
||||||
|
You can use it in the browser by using [browserify](http://browserify.org/), however if that's too much work just use <https://wzrd.in/>. There is also an example <examples/cdn.html>
|
||||||
|
|
||||||
|
|
||||||
# ideas
|
# ideas
|
||||||
|
|
||||||
- make it work in the browser for client side validation
|
|
||||||
- strict mode, dissallowing extra parameters from being passed in
|
- strict mode, dissallowing extra parameters from being passed in
|
||||||
- dependency property making one parameters existance depend on another
|
- dependency property making one parameters existance depend on another
|
||||||
- more types (phone numbers, credit card, ip address)
|
- more types (phone numbers, credit card, ip address)
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>https://wzrd.in - schemajs example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>See the console and view the source for details</p>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="https://wzrd.in/standalone/schemajs@latest"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
// Example from the README
|
||||||
|
// NOTE: You'll have to use `window.schemajs`
|
||||||
|
var model = window.schemajs.create(
|
||||||
|
{
|
||||||
|
name: {type:"string", filters:"trim", properties:{max:255}, required:true},
|
||||||
|
email: {type:"email", filters:"trim", required:true},
|
||||||
|
wins: {type:"int", filters:["trim", "toInt"], default:0},
|
||||||
|
average: {type:"float", filters:["trim", "toFloat"], default:0}
|
||||||
|
});
|
||||||
|
|
||||||
|
var form = model.validate({name:" your name ", email:" name@example.com "});
|
||||||
|
console.log(form);
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Reference in New Issue