All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Applying selected="selected" to a child:channel_field select box

John Briggs 22 Feb 2013 21:21 question, complete

I'm trying to convert this code I used in my categories:
{exp:channel:categories channel="product" style="linear" category_group="2"}
<option value="{category_id}"{if category_id IN ({low_search_category})} selected="selected"{/if}>
{category_name}
</option>
{/exp:channel:categories}


to work with this setup...

<select name="child:product_accessories">
<option value="">All</option>

{exp:channel:entries channel="accessory" dynamic="no" }
<option value="{entry_id}" ({low_search_category})}selected="selected"{/if}>{title}</option>
{/exp:channel:entries}
</select>


In essence, just trying to apply selected states to a select dropdown using playa relationships instead of categories.

Replies

  1. John Briggs 22 Feb 2013 21:48

    I've narrowed it down to this:

    <option value="{entry_id}"{if entry_id IN ({low_search_parent:product_brand})} selected="selected"{/if}>

    but need it to work with child instead, which it doesnt.

    <option value="{entry_id}" {if entry_id IN ({low_search_child:product_accessories})} selected="selected" {/if}>

  2. Low 22 Feb 2013 23:40

    This should work:

    {if entry_id IN ({low_search_child:product_accessories})} ... {/if}


    If it doesn't, try this:

    {if '{entry_id}' IN ({low_search_child:product_accessories})} ... {/if}


    If that doesn't work, send superadmin login credentials to hi at gotolow dot com so I can take a look myself.

  3. John Briggs 23 Feb 2013 18:35

    Awesome, first solutuon worked like a charm!