Closed katrinkerber closed 11 years ago
This is possible using the [develop]() branch.
{exp:dynamo:form return="{homepage}/{segment_1}/filtered/" search_id="{segment_3}" dynamic_parameters="category"}
{exp:gwcode_categories cat_id="{segment_1_category_id}" output_depth="3" style="linear" entry_count="yes"}
<label for="{cat_name}" class="checkboxlabel">
<input type="checkbox" name="category[]" id="{cat_name}" value="{cat_id}" {if {exp:dynamo:selected value="{cat_id}" in="{category}"}} selected="selected"{/if}>
{cat_name} ({entry_count})
</label>
{if cat_count == results_total}
<input type="submit" value="Apply filters" class="btn classy">
{/if}
{/exp:gwcode_categories}
{/exp:dynamo:form}
For some reason
{exp:dynamo:selected value="{cat_id}" in="{category}"}
always returns "0".
When I try:
{if "{cat_id}" == "{category}"} checked {/if}
then that works great if only one value has been selected. Of course, that doesn't work when two have been selected.
Any ideas?
Try adding parse="inward" to the gwcode_categories tag.
That worked. Thank you very much.
I can't quite see how I can check selected categories once the form has been submitted.
My form code:
What do I need to put in the IF conditional to check the selected categories?