1

Is is possible to populate a FreeForm checkbox group by an entries listing? I've got a series of courses with an entry for each one, and I'd like to create a series of checkboxes and values for each course.

The value of the checkbox gets shown in the email notification but not in the control panel. Is this possible to change?

  • I ended up creating a series of checkboxes with related hidden fields. Then used a conditional within the entry loop in the form to associate an entry title with a checkbox number. Not the smoothest solution, so if there is a better way please let me know! – Andrew Nov 20 '17 at 17:02
  • Would you mind adding your solution as an official answer instead of an update to your original question? – Brad Bell Nov 20 '17 at 20:40
1

This my solution, although it's not perfect. I set-up an entry loop within the form and included the following for a series of checkboxes:

{% if loop.index == "2" %}

<label>
    <input type="checkbox"
        name="{{ course2.handle }}[]"
        value="{{ course2.value }}"
        {{ course2.checked ? "checked" : "" }}
    />
</label>

<input type="hidden" name="{{ courseName2.handle }}" value="{{ entry.title 
}} | {{ entry.courseDate|date('j.n.y') }}"  />

{% endif %}

So in the form submission the entry title in loop 2 is attached to the Course 2 checkbox. It would have been better if {loop.index} could be used within the handle name so the 'if' conditional is not needed. As pointed out above, the value of the checkbox can be set dynamically from the entry loop, but the result is not shown in the FreeForm control panel, just the email notification. Therefore is was necessary to include the hidden field to record the entry title. Hope that all makes sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.