How to Set Custom Checkbox Values to Member Fields Answered
Hi, I created a checkbox form and I want to give value to a checkbox, so whenever member checks it and submits, the value appears in members field.
- The box asks "What industry is your eCommerce in?" and there are several answers like "Fashion", "Beauty", "Electronic"...
- I created a field called "eCommerce Industry" that has an ID of "ecommerce-industry"
- Then in webflow, before the form, I created an embed according to the #81 - Custom Checkbox Values Memberstack video.
- On the checkbox itself I created two attributes. "data-ms-member = ecommerce-industry" and "ms-code-custom-checkbox = fashion"
When I press the checkbox and press submit, the checkbox value doesn't appear in members field:(((
What should I do?
Comments
8 comments
Karolis Vaiginis, do you want the answers to be populated in a single custom field say for example like shown in the image (Skills)? In your case, someone could select fashion and personal care, and do you want those to be stored in the field Ecommerce Industry in Memberstack?
yeah, thats right, I would like it to be stored in the same field, if they select multiple. Thats also my another concern of how to limit the selection to only one of the checkboxes 😅 but let's leave it for later
Okay in case you want to let users only select one option, I would suggest you use radio buttons instead of checkbox components so that its handled for you automatically.
Here's a guide on setting that up and connecting to Memberstack field and here's a ready-made component you could clone and customize as per your use-case. Hope this helps.
oh thanks, radio buttons work! Thanks a lot:)) But now I cant find a way to submit the value to the member field.
I chose the group of "Industry" and put it on all of the radio buttons.
Then I wrote for each of the button the choice value, so there are a couple of diff buttons with diff choice value like "Fashion n Apparel", "Beauty or personal care" etc...
And then I put an attribute to each of the radio button of "data-ms-member = ecommerce-industry" (the same id like I have created in members field)
but when I submit the form, the field doesnt fill up
Welcome, I believe if you implement this, you won't need to use #81 code setup for your use-case.
I had a look at the setup and could you remove the data-ms-member attribute from the label (as shown in screenshot 1) and instead add it to each radio button element highlighted in screenshot 2? Hope this helps.
don't know why, but still doesn't work:((
Now I only left the attribute on the "ms-pill-radio" elements
Hey Karolis Vaiginis, I just checked it out from my end. Could you add another custom attribute data-ms-form="profile" to the form element as highlighted in the screenshot and test it out?
it worked!!!!! Thank you a lot:))!
Please sign in to leave a comment.