I'm having difficult with the display of a Hyperlink control on a form during Display Mode. Specifically, it doesn't appear to resize at runtime despite the respective control's attribute set to 'yes'?
The Hyperlink control is curious control in that during New/Edit modes it presents two fields; the web address and the text to display:
And during Display mode, it only displays one field; the rendered hyperlink:
However, all of the whitespace used for the two fields during the new/edit mode remains during the display mode. One workaround that comes to mind is create a rule to only display the Hyperlink field during the New/Edit mode, and during Display mode to instead show a Rich Text control with formula:
However, the limitation is that this omits the "text to display" attribute in the rendered link. Are there any other suggested workarounds for this?
Solved! Go to Solution.
Yeah, the term "resize" is actually a misnomer and could more appropriately be referred to as "Can grow" (yes/no). However, despite this behaviour, shrinking the Hyperlink control to, say, half of its height with the expectation that it'll "resize" (or grow) as required doesn't quite work. Here is the shrunken Hyperlink control during Design mode:
During Display mode, this appears OK since there's enough space to render the link:
But when in Edit mode, the two Hyperlink fields (URL and Text) overlap rather than push the content below:
The workaround I ended up implementing was to include two versions of the Hyperlink field within respective panels with conditional display rules. One was the native Hyperlink control for New/Edit mode, and the other was a Calculated Value control that constructed a basic URL from the Hyperlink Item Property. Details for anyone interested are as follows.
Panel 1 is shown during New/Edit mode and has the following rule:
The contents of Panel 1 is simply the native Hyperlink control. Resize this as required as it does not appear to respect the "resize at runtime" setting (bug).
Panel 2 is shown during Display mode and has the following rule set:
The contents of Panel 2 is a Calculated Value control. It's simply the URL string using the Hyperlink Item Property. Settings as shown below:
Optional: if you prefer not to have the link open in a new window, omit the target='_blank' attribute from the formula.
Once you publish the form, viewing in New/Edit mode should only reveal the native Hyperlink control (with two fields: address and display text):
During Display Mode when you view the form you should see the result of your Calculated Value control:
As you can see, the Calculated Value has no way (that I could find?) of using the "Text to display" attribute of the Hyperlink control. As a result, the Hyperlink's display text is the same as the web address. Not ideal, but at least it's functional!