Streaming live at 10am (PST)

Dynamic checkboxes in form with value of collection items [SOLVED]

Hello,

I’m trying to create a form where I use CMS data to create checkbox options.
However, when I fill in the form, I get a “CMS-item”:true, instead of the values that are selected.


image
Can someone help me out?

Already figured in out.

What was the solution

Hi Wells,

I added a collection list to the form.

which created this:

added some css to make it look better:


and another HTML embed with this:
<input type="hidden" name="Artworknames">

than I add custom code to set the values of the selected checkboxes inside the hidden input field, before the form is send:

var checkedValues = "";
$.each($(".checkboxcontainer), function(){
	// get value of each checkbox and add a "," to it.
	checkedValues += $(this).val().trim()+',';
});
  
    
//remove the last ","   
var values = checkedValues.replace(/,(\s+)?$/, '');
// set values in hidden input field.
$('input[type="hidden"]').val(values); 

Which gets me this in my email:

Well done! This seems to make sense, but I’m having a couple issues implementing.

Any chance you could send more detail of what this looks like in Webflow? I’m not understanding how .checkboxconatiner fits into this equation, and where you actually determine that these are not ALL values but ALL CHECKED values.

Thanks!