ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Make Advanced search form with optional keyword?

November 07, 2011 11:52pm

Subscribe [2]
  • #1 / Nov 07, 2011 11:52pm

    Podzol

    80 posts

    Hello,
    I’d like to make an advanced search form that does not require a keyword, but can use one if one is entered. For example, I would like to search by category and just pull up everything entry in that category.
    Here is the form I used that throws the “You did not submit a search term” error.

    {exp:search:advanced_form channel="gallery" result_page="gallery/search_results" search_in="everywhere" no_result_page="gallery/no_results" }
    
    <select name='cat_id[]'>
    <option value="" selected="selected">Select a Category</option>
    {exp:channel:categories channel="gallery" category_group="5"}
    <option value='{category_id}'>{category_name}</option> 
    {/exp:channel:categories}
    </select> 
                  
    <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100">  
    <input type="image" src="{site_url}images/site_graphics/search.png" value='Search'  alt="Search" name="image" width="25" height="25" >
    
    {/exp:search:advanced_form}

    Any ideas?
    thanks! I appreciate your thoughts.

  • #2 / Nov 08, 2011 8:54pm

    Sean C. Smith

    3818 posts

    Hi Podzol,

    I think it would be simpler for you to use the Category Dropdown Menu to link to all entries in a category and have a separate advanced search form.

    If there is anything else I can do to help, just let me know.

    Sean

  • #3 / Nov 15, 2011 12:51pm

    Podzol

    80 posts

    Works like a charm.

    I wish I could adjust the formatting so there isn’t and automatic

    
    

    after it, though.
    Other than that minor factor, it works perfectly!

    Blake

  • #4 / Nov 15, 2011 9:28pm

    Sean C. Smith

    3818 posts

    Podzol,

    Happy it’s working for you. I’m not sure what you’re referring to about adjusting the format so there isn’t and automatic. That bit is a little confusing, perhaps due to a typo.

    Sean.

  • #5 / Nov 15, 2011 9:33pm

    Podzol

    80 posts

    whoops! I forgot the code bracket around the break tag in my post. Sorry about that.

  • #6 / Nov 15, 2011 9:37pm

    Sean C. Smith

    3818 posts

    Podzol,

    looking at the code sample here you can remove that
    from your code just by deleting it. If that’s not working could you post a code sample and I’ll see what I can do.

    Sean

  • #7 / Nov 15, 2011 9:41pm

    Podzol

    80 posts

    I used this version, which doesn’t have a break best I can tell—not a big deal, I worked with it and the page looks just fine.

    <form name="catmenu" action="">
        <select name="selcat">
            <option value="">--Select Category--</option>
            {exp:channel:categories channel="yourchannel" style="linear"}
                <option value="{path='channel'}">{category_name}</option>
            {/exp:channel:categories}
        </select>
    </form>
  • #8 / Nov 18, 2011 5:13pm

    Sean C. Smith

    3818 posts

    Podzol,

    Awesome. Really glad you got this working. I’m going to close the thread, but feel free to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases