I would like to add a click listener to an anchor element. The click listener would make a DDS call which would return a URL, which then opens in a new window/tab.
Can you clarify which component type you want to add the rule to? I'm not aware of an Anchor component.
I am using the text display element and use the anchor link in the label.
Add a hidden Dynamic Data Button to your form that opens the URL in a new window in the onSuccess rule.
Yulius Gita - how'd you go?
Ben Warner, I had used a different way, by using the click rule of the text display field and tweaked the CSS. Your suggestion looks cleaner, I would give this a go and update. Thanks.
Just tried this and there is an error when clicking the anchor link:
anchor element DOM:
Managing Content Security Policy (CSP) Settings
Thanks Ben, that works.
I have now placed the text display field inside a repeat and I am unsure how to pass the data to the button click rule.
I have tried the following:
).scope().Form.data,$('Form').scope().Form.data.$i)">Click Me</a>data.$i is null
I would put the button in the repeat and get the data in the click rule of the button, rather than try to pass it through.
The data object has the repeat data ($i, documentId) when the button click script is invoked by clicking the actual button. However when invoked by the fireRule, the repeat data is missing.
Clicking the actual button:
Is there any function available to return/provide the repeat data?
I couldn't get this working in a repeat - did you resolve it?