X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fform%2FVTypes.js;h=6b1a1e40650cadc24322bd7b3c1806bf40ce5cc1;hb=837f04377ba365e5e01650d8ab199879f6682ee2;hp=df3bf9215e0d556b5963c3330d24d1f22e4e8959;hpb=b9c608ff9d36d8c953385fda18843c745758173a;p=roojs1 diff --git a/Roo/form/VTypes.js b/Roo/form/VTypes.js index df3bf9215e..6b1a1e4065 100644 --- a/Roo/form/VTypes.js +++ b/Roo/form/VTypes.js @@ -18,7 +18,8 @@ Roo.form.VTypes = function(){ var alpha = /^[a-zA-Z_]+$/; var alphanum = /^[a-zA-Z0-9_]+$/; var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,24}$/; - var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; + var url = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; + var urlWeb = /^((https?):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i // All these messages and functions are configurable return { @@ -47,6 +48,13 @@ Roo.form.VTypes = function(){ url : function(v){ return url.test(v); }, + /** + * The funciton used to validate URLs (only allow schemes 'https' and 'http') + * @param {String} v The URL + */ + urlWeb : function(v) { + return urlWeb.test(v); + }, /** * The error text to display when the url validation function returns false * @type String