Select to view content in your preferred language

Survey123 - Invoke JS function from a html link

490
2
11-08-2023 04:22 PM
EM-wsp
by
Occasional Contributor

Hi, 

Survey123 accepts html links (<a></a>) in notes. Html links may have "onclick" event which can be used to execute a JS function.

<a href="" onclick="myFunction();">Do it!</a>

Is there a way to setup a link in the Survey123 Excel form which invokes the JS function, which otherwise I am called though calculation:
pulldata("@javascript", "functions.js", "myFunction", ${param1}, ${param2})

Using some CSS I could turn it to a custom button in my survey.

Thank you,

0 Kudos
2 Replies
ZacharySutherby
Esri Regular Contributor

Hello @EM-wsp

Survey123 only supports the href and style attributes for the <a> tag. You can make a JavaScript function relevant based on a select_one question so if some value is selected in the select_one question the question with the JavaScript function becomes relevant and the JS function is executed. 

Thank you,
Zach
0 Kudos
EM-wsp
by
Occasional Contributor

Hi, thank you for your reply.
I ended up using a multiple_select question with only one option since it has a check-in box rather than a radio tag. Feels a liitle more intuitive.

Elena 

0 Kudos