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=”https://blog.vishalon.net”>Vishal’s Blog</a> will result in the actual hyperlink where as <a href=”https://blog.vishalon.net”></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
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.
thank you! i couldn’t believe MS did not include this functionality!?!?!?