I am trying to run a method that validates an URL, and then, if the URL is Ok, Patrick’s Browser Bean will display it by calling to this function onShowDisplayWebpage (which does some other things).
This method or function is run as an ‘onShow’ event of a form.
function onShowHideShow(firstShow, event){
var urlregexExpression = '(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=#]*)?';
var urlregexValidation = metadata_initial_path_or_url.match(urlregexExpression);
if(!urlregexValidation){
elements.bean_browser.visible = false;
}else{
elements.bean_browser.visible = true;
onShowDisplayWebpage();
}
}
I am sure it did not work because I am quoting the variable urlregexExpression. I need to escape some of the characters but I don’t know what I am doing wrong.
Has anyone validated an URL via a function before? Can you share the code?
Thanks! JC