Power Apps – Validate the URL only if the URL is entered in text box

Again i am back with a quick post, I had the validate the following scenario,

I needs to put the validation, “if the URL is entered then only check the URL is valid”.

  1. Edit form bind to SharePoint List
  2. A HyperLink SharePoint Value bind to the DataCard.

I have achieve this by doing the following steps

  • Validate the URL with Regex, if the URL is filled. So in the “Required” Field for DataCard put the following text
    If(!IsBlank(DataCardValue5.Text) && !IsMatch(DataCardValue5.Text, “(?:http(s)?:\/\/)?[\w.-]+(?:.[\w.-]+)+[\w-._~:/?#[]@!\$&'()*+,;=.]”),true,false)
DataCard Required Property
  • Error Message if not Valid. Put the Following text in ErrorMessage field “Text” property
    If(!IsBlank(DataCardValue5.Text) && IsMatch(DataCardValue5.Text, “(?:http(s)?:\/\/)?[\w.-]+(?:.[\w.-]+)+[\w-._~:/?#[]@!\$&'()*+,;=.]”),””,””)
Error Message

You can see the result in following gif

Check out the following url
https://thatapiguy.tech/2019/09/18/validate-a-url-in-powerapps/, well written quick tip.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s