function custom_upload_dropdown_script() { ?> document.addEventListener('DOMContentLoaded', function () { // Get the file upload field const fileUploadField = document.querySelector('input[type="file"]'); // Adjust if needed // Get the dropdown field wrapper const dropdownFieldWrapper = document.querySelector('.wpforms-field-select'); // Adjust this selector to match your dropdown field wrapper // Check if both fields exist if (fileUploadField && dropdownFieldWrapper) { // Initially hide the dropdown field dropdownFieldWrapper.style.display = 'none'; // Add event listener to the file upload field fileUploadField.addEventListener('change', function () { if (this.files && this.files.length > 0) { // Show the dropdown field dropdownFieldWrapper.style.display = 'block'; } else { // Hide the dropdown field if no file is uploaded dropdownFieldWrapper.style.display = 'none'; } }); } else { console.warn("Could not find the file upload or dropdown field. Check your selectors."); } });