Conditional Logic within nested forms are disabled

I have seen multiple threads on this all of which have been closed without any response. Unfortunately i cannot reply to these people anymore but I was able to fix this with some javascript.

OPTION 1
var disabledInputs = document.querySelectorAll('input:disabled');
var disabledTextArea = document.querySelectorAll('textarea:disabled');
var disabledSelect = document.querySelectorAll('select:disabled');

// Loop through the disabled inputs and enable them
for (var i = 0; i < disabledInputs.length; i++) {
  disabledInputs[i].disabled = false;
  disabledTextArea[i].disabled = false;
  disabledSelect[i].disabled = false;
}

Option 2 - Using an mutation observer
// Select the element that contains the input fields
var targetNode = document.getElementById('gform_34');

// Create a new observer
var observer = new MutationObserver(function(mutations) {
  mutations.forEach(function(mutation) {
    // Check if the mutation affected a disabled input field
    if (mutation.type === 'attributes' && mutation.attributeName === 'disabled') {
        
        var inputField = mutation.target;
        inputField.disabled = false;
        
    }
  });
});

// Configure the observer to watch for changes to the attributes of input fields
var config = { attributes: true, attributeFilter: ['disabled'] };

// Start observing the target node
observer.observe(targetNode, config);

Hi,

Thanks for sharing your solution. However, conditional logic should work within nested forms without any issues. I’m curious to know more about the issue you’re experiencing, and I will suggest you contact us via our support form so we can dig into this. Once the issue is confirmed, our developers will work to fix this within the GP Nested Forms Perk so you don’t have to use extra custom javascript snippets.

Best,

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.