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

Support archive

Using search:title and ^value to only match the first letter...

David K 10 Aug 2015 12:29 question, complete

Hi -

I am using a form and keywords and filter tags to refine the form results.

One filter has letters tags for each letter A - Z and sending the letter via the title parameter and the low_url and javascript re-loads that encoded url to the results tag. The title results get passed to parameter: search:title using the = "^value"

Problem is when there is no results from the title tag, the ^ remains and the results come back as empty I guess because the '^' is still trying to be matched?

Can you give a better way to get at the title value from the parameters of the results tag?

I have spent hours using different approaches with stash variables and if conditionals and narrowed this down to the ^ being left by itself in some cases in the search:title parameter...

thanks,

David

Replies

  1. Low 10 Aug 2015 12:33

    Try using this combination of parameters:

    search:title="value" starts_with="search:title"

    These parameters are identical to

    search:title="^value"

  2. David K 10 Aug 2015 12:40

    The problem is what do I put in the 'value' for search:title? Nothing seems available, this: {low_search_title}? In results tag it doesn't seem to parse...

  3. Low 10 Aug 2015 12:42

    As per these rules: {low_search_param_name}, so {low_search_search:title}.

  4. David K 10 Aug 2015 12:57

    I tried that - it does not parse in this:

    {exp:low_search:results query="{segment_3}" search:title="{low_search_search:title}" starts_with="search:title"

    and this is what I am passing back to the search:


    <li><a id="filter_all" class="filter_active" href="{if segment_3}{low_search:url search:title=''}{/if}">All</a></li>
    <li><a id="A" href="{if segment_3}{low_search:url search:title='A'}{/if}">A</a></li>
    <li><a id="B" href="{if segment_3}{low_search:url search:title='B'}{/if}">B</a></li>


    Does that look right?

    And even when it is empty it should show all the unfiltered results and it isn't...

  5. David K 10 Aug 2015 13:00

    Low Search is amazing by the way!! :-) Really astounding how complete it is and what it does... It was all good until I hit this point using the filter tag...

  6. Low 10 Aug 2015 13:03

    Okay, I should have been more clear. The two parameters you can use, you can use separately in the form/URL tag and Results tag. So, if you're generating lists with URLs like so (simplified):

    {exp:low_search:filters} 
    {low_search:url search:title="A"}
    {low_search:url search:title="B"}
    {low_search:url search:title="C"}
    ...
    {/exp:low_search:filters}


    You can use the starts_with="" param on the Results tag:

    {exp:low_search:results starts_with="search:title" ... }

  7. David K 10 Aug 2015 13:15

    Yea, bingo... that worked! Thanks Low!

    I am doing the same thing for a category filter, which works great except the resetting to NO CATEGORIES selected seems random in terms of what it does... so, can I ask what is the best practice way to pass back "no category"?


    <input onchange="{if segment_3}location.href='{low_search:url category=''}';{/if}"
    type="radio" name="category[]" value=""
    {if low_search_category ~ '/\b'.category_id.'\b/'} checked{/if}
    >Show All

  8. Low 10 Aug 2015 16:11

    This should remove the category parameter from the URL (within the Filters, Form or Results tag):

    {low_search:url category=""}


    To have the checkbox checked or not, you should use this conditional:

    {if low_search_category == ''}...{/if}

  9. David K 17 Aug 2015 15:33

    Thanks Low for confirming this...

    Again, really great efforts on all these EE modules and plugins.

    Best,

    David