+ Start a Discussion
AnshulJainAnshulJain 

create a hyper link if the value entered is a url in <apex:inputTextarea>

Hi can anyone help me with creating a hyper link it the value entered is a url in the textbox.

 

thanks in advance to anyone who helps :)

Best Answer chosen by Admin (Salesforce Developers) 
Edwin VijayEdwin Vijay

You can use javascript to validate if the value is an URL

function checkURL(value) {
  var urlregex = new RegExp(
        "^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
  if(urlregex.test(value))
  {
    return(true);
  }
  return(false);
}

 You could then use different div's to display if the value is URL