ruleBuilder)
+ {
+ return ruleBuilder.SetValidator(new UrlValidator());
+ }
+ }
+
+ public class UrlValidator : PropertyValidator
+ {
+ public UrlValidator()
+ : base("Invalid Url")
+ {
+ }
+
+ protected override bool IsValid(PropertyValidatorContext context)
+ {
+ if (context.PropertyValue == null) return false;
+ return context.PropertyValue.ToString().IsValidUrl();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/UI/Form/FormBuilder.js b/src/UI/Form/FormBuilder.js
index d68608dea..53700b614 100644
--- a/src/UI/Form/FormBuilder.js
+++ b/src/UI/Form/FormBuilder.js
@@ -17,6 +17,10 @@ var _fieldBuilder = function(field) {
return _templateRenderer.call(field, 'Form/HiddenTemplate');
}
+ if (field.type === 'url') {
+ return _templateRenderer.call(field, 'Form/UrlTemplate');
+ }
+
if (field.type === 'password') {
return _templateRenderer.call(field, 'Form/PasswordTemplate');
}
@@ -56,4 +60,4 @@ Handlebars.registerHelper('formBuilder', function() {
});
return new Handlebars.SafeString(ret);
-});
\ No newline at end of file
+});
diff --git a/src/UI/Form/UrlTemplate.hbs b/src/UI/Form/UrlTemplate.hbs
new file mode 100644
index 000000000..7f41272f1
--- /dev/null
+++ b/src/UI/Form/UrlTemplate.hbs
@@ -0,0 +1,8 @@
+