Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/js/brutusin-json-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ if (typeof brutusin === "undefined") {
"minProperties": "At least `{0}` properties are required",
"maxProperties": "At most `{0}` properties are allowed",
"email": "The email must at least consists an asterisk (@), following by a domain name with a dot (.)",
"url": "The URL provided is not a valid URL.",
"uniqueItems": "Array items must be unique",
"addItem": "Add item",
"true": "True",
Expand Down Expand Up @@ -231,6 +232,8 @@ if (typeof brutusin === "undefined") {
input.type = "email";
} else if (s.format === "password") {
input.type = "password";
} else if (s.format === "url") {
input.type = "url";
} else if (s.format === "text") {
input = document.createElement("textarea");
} else {
Expand Down Expand Up @@ -293,6 +296,12 @@ if (typeof brutusin === "undefined") {
return BrutusinForms.messages["email"];
}
}

if (!s.pattern && s.format === "url") {
if (!value.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/)) {
return BrutusinForms.messages["url"];
}
}
}
if (value !== null && !isNaN(value)) {
if (s.multipleOf && value % s.multipleOf !== 0) {
Expand Down