5

I have a multiple page Safecracker form, as there are a number of large category groups that need to be chosen from. On Page 2, I have a content type select. On Page 3, I have a topic select. And, on Page 4, I have a number of selects to reference syllabus documents.

The select fields look like this, that is the categories shown are being filtered by group_id:

<select name="category[]" id="select_syll-ac" multiple="multiple" class="multiselect">
          {categories group_id="17"}
                  <option value="{category_id}"{selected}>{category_name}</option>
          {/categories}
</select>

Currently, only the options selected on Page 4 are making it to the final entry. I thought that previously the options selected on page 2 were also being retained.

preserve_checkboxes=“yes” does not fix the behaviour.

Given Pages 2, 3 and 4 are all dealing with categories, do I have to add a hidden select of the category groups on Page 2 and 3 to Page 4?

3

You probably need to output the already checked categories in order to preserve the selection. You can output those categories in hidden fields in each pages:

{categories}
{if '{selected}' != ''}<input type="hidden" name="category[]" value="{category_id}" />{/if}
{/categories}

otherwise, on each submit containing the field category[], the categories will be reset to the new form values.

| improve this answer | |
  • Thanks, that is what I figured. I was just wondering if there was something I was missing. – Simon Job Nov 28 '12 at 10:23

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.