Skip to main content
Nintex Community Menu Bar
Question

Set the value of a radio button based on the value of another radio button

  • December 13, 2024
  • 0 replies
  • 24 views

Forum|alt.badge.img+1

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('input[value="N/A"]').prop('checked', true);
        } else {
            // Optionally, clear Q8Response or leave unchanged
            q8Response.find('input').prop('checked', false);
        }
    });
});

 

the controls are configured as follows

 

Translate
Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings