Question

In Orbeon 4.4 Form Builder, I'd like to be able to add a hyperlink control to a form, where the target URL is constructed partially from values available in other form fields. In addition, I would like to be able to control the visibility of the hyperlink the same way as other FB controls (i.e. via the "relevent" attribute). What would be the best approach?

Tried using the existing "link button" control, & adding this within the appropriate corresponding <xf:trigger> tag in the source:

<xf:action ev:event="DOMActivate">
    <xf:load show="new" resource="http://staticurl.com"/>
</xf:action>

This works with a static url as the resource attribute (as in the example), but I can't get it to reference a value in another field.

I was able to use an AVT in the href attribute of an <a> tag, like so:

<xh:a target="_blank" href="{url-field}">LINK</xh:a> 

(In this case "url-field" was a field that constructed the URL via calculate=). However, even though this works, the <a> tag doesn't work in the FB editor like a standard FB control does, plus I don't know how well FB will deal with it as I make other changes to the form.

Was it helpful?

Solution

You can use attribute value templates in xf:load/@resource attributes like you've done in the simple link:

<xf:action ev:event="DOMActivate">
    <xf:load show="new" resource="{xxf:bind('url-field-bind')}"/>
</xf:action>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top