When exporting Gravity Forms entries, would you like for the form fields you added to be selected by default?
Here is a snippet of javascript that does the trick. It utilizes the MutationObserver class to observe changes to the DOM.
The observer waits for the DOM to load the container list then manipulates the checkboxes within. Only checkboxes with a numeric value are initially checked. Those are the fields manually added to your form.
const targetNode = document.getElementById("export_field_container"); const config = {childList: true, subtree: true}; // Observe direct children and descendants const observer = new MutationObserver((mutationsList, observer) => { for (const mutation of mutationsList) { mutation.addedNodes.forEach(node => { let checkbox = node.firstElementChild; // Perform operations on each checkbox if (!isNaN(checkbox.value)) { checkbox.checked = true; } }); } }); observer.observe(targetNode, config);
Place this snippet inside an admin js file or use the admin_footer action hook.