MemberStack.io

Prefilling checkboxes during multi-step signup

Hi Support,

EDIT: we are using Webflow with memberstack

I am trying to have a form with a checkbox pre-fill based on a signup field. I set

ms-data="<fieldname>"

on the Checkbox input field, but it doesn’t seem to be working correctly (it isn’t pre-checked if the value for the field is true)

I also tried setting

ms-field="<fieldname>"

but the behavior is the same.

The member tab in memberstack.io correctly shows the value as

<fieldname>=True/False after submitting the form the first time, but I’m trying to have the checkbox pre-filled for future profiles updates from the user.

I have set ms-update="profile" on the form itself.

I confirmed the behavior using a blank form with a single checkbox input from a user with the value set to True.

Am I doing this incorrectly or is this just unsupported?

Thanks,
Robin

Hi Robin,

At the moment checkboxes aren’t supported which is honestly more of a bug on our part.

I’m going to take a note of this for us to improve soon.

For now you can still get this to work but it will require custom code. You will need to use our JS hook to get the value of the checkbox fieldname, then depending if it is true or not, check the checkbox with JS.

Here’s a short code snippet that should help

<script>
    MemberStack.onReady.then(function(member) {

        if (member["checkbox"] === "true") {
            document.querySelector("[my-checkbox]").checked = true
        }

    })
</script>

change “checkbox” to your actual fieldname, and give the checkbox an attribute of my-checkbox=true

Let me know if this helps!

Gotcha! Thanks for letting me know.

Some feedback: Would be great if you guys could open source some of the interfacing code so community members (like me) can add some side features! Definitely understand if that’s not an option though.

Best,
Robin

1 Like

Hey @belltyler or @robinkurosawa or @DuncanHamra I’m a n00b but would love to use that Javascript to acheive the same result!

3 quick questions:

Where would I paste the JS?
What is the fieldname? Is that what Webflow calls the Checkbox’s name?
Does the form itself need special MS attributes?

Really appreciate the help!

@admins where do you suggest is the best place to get an answer/feedback on this question?

Hey Eric :wave:

Welcome, and thank you for posting in the forum! :partying_face: Happy to help. Could you make a new forum post with your specific information like what platform/service you are using? I don’t want your answers to be lost. :slight_smile:

Thanks Josh, appreciate it! Just dropped a post: Prefill Checkboxes/Radio Buttons--is custom JS the only solution rn?

1 Like