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.

Results page from Simple Search and Advanced Search form on the same page

March 19, 2014 12:26pm

Subscribe [2]
  • #1 / Mar 19, 2014 12:26pm

    mvcreative

    12 posts

    Hello again,
    I have a simple form with the keywords field and searching on “events” channel.  The results page displays what we need but the request we got is to display on a left column next to the results, an advanced form to let the user select other sections (channels), date, etc. 

    Is this possible?  The page is not executing the javascript code that’s inserted.

    Any ideas?

  • #2 / Mar 19, 2014 1:34pm

    Rob Allen

    3114 posts

    That should work fine, so long as the search form tag and search results tag are separate, after all the search results template is just a template like any other. I have put a search on a results page before with no problems.

    Can you post your template code?
    make sure the results template is not cached!

  • #3 / Mar 19, 2014 2:02pm

    mvcreative

    12 posts

    Hi Rob,
    Thanks to your comment I know is doable, so I Isolated the code to use only the results and advanced form tags.  So the problem is on my template’s code.

    Will take a look and see if I can spot the problem (the template is using stash and template partials).

    {embed="layouts/subpage }
    
    {exp:stash:set name="pageContent"}
     <h1> Search Results </h1>
    <-- this displays fine -->
        <dl>
            {exp:search:search_results}
                <dt><a href="http://{title_permalink=">{title}</a></dt>
                <dd>{event_overview} or something</dd>
            {/exp:search:search_results}
        </dl>
        
        <hr>
    
    <-- this displays fine and the js code is added but doesn't submit -->
    {exp:search:advanced_form 
        show_future_entries="yes"
        result_page="search" 
        no_result_page="search/noresults"
        channel="about|events|support_membership|news"
    }
    
    <!-- /code from the sample form on EE help -->
    {/exp:search:advanced_form}
    
    {/exp:stash:set}

    Same code but without the stash and embed works great.

     

    Thanks!

  • #4 / Mar 19, 2014 2:40pm

    Rob Allen

    3114 posts

    I would take Stash out of the equation since a results page needs to be built on the fly. A results page IMHO doesn’t really need to be “Stashed” 😊 Each form needs a unique ID that EE creates on the fly, it’s possible that Stash gets in the way of this.

    Also the advanced search tag parameter result_page=“search” - is the path correct?

  • #5 / Mar 21, 2014 5:52pm

    mvcreative

    12 posts

    Thanks Rob,
    That was the issue.  The URL for the search was just for the testing… it will point to the advanced search page.

    Thanks a lot!

  • #6 / Mar 22, 2014 10:28am

    Rob Allen

    3114 posts

    No problem, glad you got it sorted!

  • #7 / May 05, 2014 2:49pm

    mvcreative

    12 posts

    I went back and did a second review… the problem was with the interface between the chair and the computer.
    I had a duplicated declaration of the search tags in another embed and that was causing the problem.

    So just to confirm, stash + advanced search scripts worked great!

    Thanks again.

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

ExpressionEngine News!

#eecms, #events, #releases