1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

<xen:checkboxunit>, <xen:options> and checked...

Discussion in 'XenForo Development Discussions' started by Liam W, Jan 12, 2014.

  1. Liam W

    Liam W Well-Known Member

    I have this in an admin template:

    <xen:checkboxunit label="{xen:phrase liam_walc_prod_add_ug}:" name="usergroups">
            <xen:options source="$usergroups" checked="$product.usergroups" />
            <xen:explain>{xen:phrase liam_walc_prod_add_ug_exp}</xen:explain>
    $products.usergroups is an array, like so (using the dump template helper):

    array(2) {
      [0] => string(1) "3"
      [1] => string(1) "1"
    The checkboxes show fine, but none of them are selected, even with the array above.

    Any idea as to why? It's got me stumped...

  2. Liam W

    Liam W Well-Known Member

    Ok, this really is starting to annoy me now, it's happening with a different set of data as well...

    What am I doing wrong?!?!?

  3. Liam W

    Liam W Well-Known Member

    Ok, figured it out...

    The source array should contain a checked key, to tell if it should be checked or not.

    The checked entry does nothing...

  4. HotCopper

    HotCopper Member

  5. Liam W

    Liam W Well-Known Member

  6. HotCopper

    HotCopper Member

  7. Cylent1

    Cylent1 Active Member

    Any good tutorial on how to make an array for this checkbox option in style properties?

Share This Page