0

I'm using categories in a user:edit tag and also in a user:profile tag on separate templates. In the user:profile template the categories that the user is assigned to appear, however in the user:edit template the checkbox for the assigned category is not selected. Should it be? All other member data is populating as expected.

I'm using this code from the example as a test:

{categories}
    {category_selected}selected="selected"{/category_selected}
    {category_body}
        <input type="checkbox" name="category[]"
        value="{category_id}" {selected} /> {category_name}
    {/category_body}
{/categories}

1 Answer 1

0

Because this is a checkbox, you should be using checked instead, so something like this:

{categories}
    {category_selected}checked="checked"{/category_selected}
    {category_body}
        <input type="checkbox" name="category[]"
        value="{category_id}" {selected} /> {category_name}
    {/category_body}
{/categories}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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