Hi Max,
Logged on this morning and discovered that it’s working perfectly! Thank you to you and the dev team. Did the dev team do something in the background to make it work?
Looks like the JS code in the form is differen’t from the original that you sent through:
const widgetSelector =
‘#eapps-form-builder-63498d7a-5c3d-4102-be49-ddfa279c560b’;
const targetLabel =
‘Is your service address located within our current service area?’;
const newButtonText = ‘Join Our Waiting List’;
const newButtonLink = ‘https://k9poopertroopers.com.au/waiting-list’;
const originalTextMap = new WeakMap();
const patchedInputs = new WeakSet();
let buttonGlobalBound = false;
function patchStep(container) {
const field = […container.querySelectorAll(‘[class*=“FormFieldLayout__Container-sc”]’)]
.find(f => {
const labelEl = f.querySelector(‘[class*=“FormFieldLayout__Label-sc”]’);
return labelEl && labelEl.textContent.trim().toLowerCase()
.startsWith(targetLabel.toLowerCase());
});
if (!field) return;
const buttonEl = container.querySelector(‘button[aria-label=“Get Your Free Quote”]’);
if (!buttonEl) return;
const buttonLabel = buttonEl.querySelector(‘[class*=“ButtonBase__Ellipsis-sc”]’);
if (!buttonLabel) return;
if (!originalTextMap.has(buttonEl)) {
originalTextMap.set(buttonEl, buttonLabel.textContent);
}
const noInput = field.querySelector(‘input[value=“No”]’);
const yesInput = field.querySelector(‘input[value=“Yes”]’);
if (!noInput || !yesInput) return;
function updateButtonState() {
const shouldShowAlt = noInput.checked || (!noInput.checked && !yesInput.checked);
const getNewText = () => {
if (shouldShowAlt) return newButtonText;
if (buttonEl.hasAttribute('aria-label', 'Next')) return 'Next';
return originalTextMap.get(buttonEl);
};
buttonLabel.textContent = getNewText();
buttonEl.dataset._waitingActive = shouldShowAlt ? "1" : "0";
}
[noInput, yesInput].forEach(input => {
if (!patchedInputs.has(input)) {
patchedInputs.add(input);
input.addEventListener(‘click’, () => setTimeout(updateButtonState, 0));
}
});
if (!buttonGlobalBound) {
buttonGlobalBound = true;
buttonEl.addEventListener(‘click’, (e) => {
if (buttonEl.dataset._waitingActive === “1”) {
e.preventDefault();
e.stopPropagation();
window.open(newButtonLink, ‘_blank’);
}
}, true);
}
updateButtonState();
}
const waitForWidget = setInterval(() => {
const container = document.querySelector(widgetSelector);
if (container) {
patchStep(container);
setInterval(() => patchStep(container), 300);
clearInterval(waitForWidget);
}
}, 300);