Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e0cf49a

Browse files
committed
support async (promised) validators #170
1 parent 9cca07c commit e0cf49a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

‎full/schema.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ import {
44
validators
55
} from "../../src";
66

7+
let customAsyncValidator = function(value) {
8+
return new Promise((resolve, reject) => {
9+
setTimeout(() => {
10+
if (value)
11+
resolve();
12+
else
13+
resolve([ "Invalid value from async validator" ]);
14+
}, 1000);
15+
});
16+
};
17+
718
module.exports = {
819
fields: [
920

@@ -56,7 +67,7 @@ module.exports = {
5667
model: "website",
5768
placeholder: "Enter your website",
5869
inputName: "website",
59-
validator: validators.url
70+
validator: customAsyncValidator//validators.url
6071
}, {
6172
type: "input",
6273
inputType: "tel",
@@ -120,8 +131,8 @@ module.exports = {
120131
inputType: "number",
121132
label: "Number",
122133
model: "age",
123-
styleClasses: "half-width",
124-
validator: validators.number
134+
styleClasses: "half-width"
135+
//validator: validators.number
125136
}, {
126137
type: "input",
127138
inputType: "range",
@@ -312,7 +323,8 @@ module.exports = {
312323
rows: 4,
313324
validator: validators.string
314325
}, {
315-
type: "text",
326+
type: "input",
327+
inputType: "text",
316328
label: "Field with buttons",
317329
model: "address.geo",
318330
disabled: false,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /