Here ya go: https://www.loom.com/share/f66b4a0ea03b4f39933594099415c900
And the code:
<script>
document.addEventListener("DOMContentLoaded", function() {
// Get the SMS number input field and the checkbox
var smsNumberField = document.getElementById('o8a136581e149-sms_number');
var checkboxField = document.getElementById('o8a136581e149-f3182');
// Function to update the required attribute of the checkbox
function updateCheckboxRequirement() {
if (smsNumberField.value.trim() !== "") {
checkboxField.required = true;
} else {
checkboxField.required = false;
}
}
// Attach event listeners to the SMS number field
smsNumberField.addEventListener('input', updateCheckboxRequirement);
// Call the function initially in case the field is pre-filled
updateCheckboxRequirement();
});
</script>