Skip to main content

I have two radio button controls (Q7Response, Q8Response). I want to set the value of Q8Response to “N/A” if the value of Q7Response is “No”.

 

I have the following JavaScript code; however, it is not firing as expected.

NWF.FormFiller.Events.RegisterAfterReady(function () {
// Get references to the radio button controls
var q7Response = NWF$('#' + Q7ResponseClientID); // Replace with actual Client ID
var q8Response = NWF$('#' + Q8ResponseClientID); // Replace with actual Client ID

// Set up an event listener for changes to Q7Response
q7Response.change(function () {
var selectedValue = q7Response.find('input:checked').val(); // Get selected value of Q7Response

if (selectedValue === "No") {
// Set Q8Response to "N/A"
q8Response.find('inputnvalue="N/A"]').prop('checked', true);
} else {
// Optionally, clear Q8Response or leave unchanged
q8Response.find('input').prop('checked', false);
}
});
});

 

the controls are configured as follows

 

Be the first to reply!

Reply