Jump to content

problem using Validate::isUrl


Recommended Posts


Please forgive me for my bad english, I'm a french people.
I'm trying to verify if my input text in my form is in URL format.

if(Tools::isSubmit('submiturl')) {
    if(Validate::isUrl(Tools::getValue('myurl'))) {
        $smarty->assign('ERR', "URL OK" . Tools::getValue('myurl'));
    } else {
        $smarty->assign('ERR', "URL NOK" . Tools::getValue('myurl'));

This code returns "URL NOK" if myurl is empty, but always returns "URL OK" if anything is post.
Could you help me to verify if myurl is in URL format ? the Validate::isUrl seemd to not function.

Thanks in advance for your help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...