Post

3 followers Follow
1
Avatar

SMS field update request

Jake Moore

With the updated registration requirement to use high volume SMS, it is required to have a consent check box for the SMS field. Is it possible to create a required checkbox that is only required to check when the SMS field is filled out?

Scenario. I don't want to require an SMS field to be completed on my opt in forms. But the new SMS requirements are saying a consent checkbox is required for SMS fields. If the SMS checkbox is required to be checked in order to submit the form but I'm not requiring SMS field it doesn't make sense. I should only have to check the box if I have completed the SMS field.

This is a bit of a barrier in lead generation. If I only want to give my email but am required to check an SMS box that seems janky and would cause me to pause before opting in.

Please to leave a comment.

4 comments

0
Avatar

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>

 

Landon Ray 0 votes
Comment actions Permalink
0
Avatar

Note that this code won't work for your page, because it's got my element IDs in there. So you'll need to repeat the process for your page.

 

Landon Ray 0 votes
Comment actions Permalink
0
Avatar

Non required SMS number on a Booking page.

Thanks Landon,

Before I spend time testing, should this code work in the footer script of a Booking page?

Use case: Optional SMS notifications for self scheduled calls and zoom sessions. 

Arnie J Wentland 0 votes
Comment actions Permalink