InfoPath: Conditionally Hide Hyperlink Control

By | April 30, 2010 | 1 Comment
Category: Infopath Tags:

You may have been to a situation where you have to conditionally hide the hyperlink control but unlike many other InfoPath controls, hyperlink controls does not support conditions. But there is a way to hide this control. 🙂

Here is my main data source.

IsVisible is a boolean field and Hyperlink is a string storing URL. I want to show the URL only when IsVisible is “true”.


It is a very simple solution. If you know HTML, here is a hint.

HTML code <a href=””>Vishal’s Blog</a> will result in the actual hyperlink where as <a href=””></a> will result in the “hidden” hyperlink.

The same concept is applied here to hide the hyperlink control. Using my main data source, I will insert hyperlink control with following values

Display Data Source value is

substring("My Hyperlink",1,(my:IsVisible="true")*string-length("My Hyperlink"))

So for your code, you may use

substring(String/Node,1,(Boolean Condition)*string-length(String/Node))

Here Boolean Condition evaluates to 0 or 1 and hence the substring function will return either blank string or  String/Node value.

You may download InfoPath template example for conditionally hiding hyperlink control.

About Vishal Monpara

Vishal Monpara is a full stack Solution Developer/Architect with 13 years of experience primarily using Microsoft stack. He is currently working in Retail industry and moving 1's and 0's from geographically dispersed hard disks to geographically dispersed user leveraging geographically dispersed team members.

One thought on “InfoPath: Conditionally Hide Hyperlink Control

  1. thomas

    thank you! i couldn’t believe MS did not include this functionality!?!?!?

Leave a Reply

Your email address will not be published. Required fields are marked *