Hi, I have a SAEF, where I use the form_helper plugin. One of my fields is a checkbox field, where I need to check multiple checkboxes.
When I use the CP all is fine. I have my bunch of checkboxes in the Edit entry page. I can check as many as I want and have them submitted. When I use the weblog entries tag to display the values of the checked boxes, all works fine. So the checkboxex ext seems to work fine.
The SAEF code
{exp:form_helper:custom_pulldown entry_id="{entry_id}" field_name="shopsoftware"}
<input type="checkbox" name="{field_id}[]" value="{value}" {checked}>{value}
{/exp:form_helper:custom_pulldown}
<input type="hidden" name="{exp:form_helper:field_grabber field_name='shopsoftware' which='format'}" value="br" />
The problem: This code doesn´t pull any info from the database. So let´s say I have 4 checkboxes A, B, C, D. A + B are checked. When i use this code ALL checkboxes are unchecked. When I ceck C+ D and submit C an D will be marked as checked in the database and the weblog entries tag on my single entry page for the entriy will show the values of all 4 entries. So, adding multiple options works. But the fom itself will still be emtpy. So, what can I do to make this form display the correct state of the 3 checkboxes so that I can see what is checked and can then check and uncheck the boxes as needed?
I tried a lot and added the array-brackets [] to quite a few parts of the code and also added “multiple” as a value to <input… But that didn´t work.
When I leave out the [] after {field_id} in
<input type="checkbox" name="{field_id}[]"....
then I can check just one checkbox (no multiple here) but the form wil display the checked option so I can uncheck it and check another one. If I check more than one box, only the last one will be marked as checked.
But I want the beste of both worlds - multiple checkings plus visibility of checked options 😉 Anybody who can help? maybe the form_helper doesn´t like multiple checkboxes at all?
One more thing: When a user enters his data the first time, I use just a SAEF without the form_helper plugin. I thought, that
<input type="checkbox" name="field_id_19[]" value="{value}" {checked}>{value}
would show me all of the checkboxes defined and let the user check as much as he wants. But this doesn´t work. I just get one checkbox and the value of the checkbox is {value}. Can someboy help me with that too?
Thanks awa
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.