I figured it out myself - the biggest stumbling block was how to determine the value of the selected radio button on change. Each time a form is generated, a unique html name for the form is created. Here are some instructions using jQuery and/or Nintex’s flavor of jQuery.
Note: for this example, I simply alerted the value on change - you could of course invoke another function as well.
Steps to implement (SharePoint for Nintex - SharePoint 2019):
- In the Advanced configuration of the Choice control, create a Client ID JavaScript variable name, in this case I used TLinePendFRChoice.
- In the Form Settings, add a call to jQuery in the Custom JS Includes section, like: https://code.jquery.com/jquery-1.12.4.min.js; or depending on what else you are doing, use Nintex's built in jQuery clone (NWF$ syntax) and omit this step. If you do, be sure to use the second block of code below.
- Add your choice of code blocks below into the Form Settings Custom JavaScript section.
Note: The _spBodyOnLoadFunctionNames.push is a more elegant version on jQuery's document ready function, which has a hard time with some SharePoint/Nintex timings. If you have a lot to do after the page loads, add it all in this function as you would a document.ready function.
I hope this helps someone!
_spBodyOnLoadFunctionNames.push("myCustomFunctionName");
function myCustomFunctionName() {
$('#'+TLinePendFRChoice).change(function(){
var value = $($('#'+TLinePendFRChoice).find("input:checked")).val();
alert(value);
});
}
_spBodyOnLoadFunctionNames.push("myCustomFunctionName");
function myCustomFunctionName() {
NWF$('#'+TLinePendFRChoice).change(function(){
var value = NWF$(NWF$('#'+TLinePendFRChoice).find("input:checked")).val();
alert(value);
});
}