I want my users to be able to post articles so I'm using channel:form to accomplish this, everything's working great but I can't work out how to output categories as checkboxes, I have two category groups that i'd like to output separately, the code i've tried either outputs all categories or none.
I have the following code:
{exp:channel:form channel="work" return="contribute/thanks"}
<p>
<label for="title">Title</label>
<input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" onkeyup="liveUrlTitle();">
<input type="hidden" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50">
</p>
<h2>Formats</h2>
{categories}
{if category_group_id == 4} {!-- formats --}
<label class="checkbox">{category_name}
<input type="checkbox" id="{category_id}" name="{category_id}[]" value="">
</label>
{/if}
{/categories}
<h2>Industries</h2>
{categories}
{if category_group_id == 1} {!-- industries --}
<label class="checkbox">{category_name}
<input type="checkbox" id="{category_id}" name="{category_id}[]" value="">
</label>
{/if}
{/categories}
<p><input type="submit" name="submit" value="Submit"></p>
{/exp:channel:form}
This isn't outputting any categories, seems it's not understanding the if statements? However if I use the code shown on the example (http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_form/#categories)
<label for="categories">Categories</label>
<select name="category[]" id="categories" size="4" multiple="multiple">
{categories}
<option value="{category_id}"{selected}>{category_name}</option>
{/categories}
</select>
This outputs all of the categories into one select dropdown, i'm struggling to see how to adapt this, any ideas would be most appreciated!