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.

New Search on Search Results page - odd behavior

January 21, 2011 5:18pm

Subscribe [4]
  • #1 / Jan 21, 2011 5:18pm

    julie p

    282 posts

    Hi all. I have a search box on my site. On the search results page, the client wants to prepopulate another search field with the previous search term. Here’s what I have:

    {exp:search:simple_form weblog="articles" result_page="search/results" results="10" where="any" search_in="everywhere"}
    <input type="text" class="text" name="keywords" id="keywords" value="{exp:search:keywords}" />
    <input type="image" class="submit" src="/images/search-again.gif" id="search-button" alt="Search Again" />
    {/exp:search:simple_form}

    and then:

    {exp:search:search_results paginate="bottom"}
        <div class="result">
            <a href="#"><strong>{title}</strong></a>
    
                {exp:search_marker}{excerpt}{/exp:search_marker}
        </div>
    {/exp:search:search_results}

    And it is spitting out this HTML code:

    <input type="text" class="text" name="keywords" id="keywords" value="Traditional Chinese Medicine (TCM) can offer much help to sufferers of auto immune diseases, yet this fact remains largely unknown to many patients and their doctors. As a TCM practitioner with specialized training in the field of autoimmunity, I am often frustrated by the difficulty of getting this knowledge across to…" />


    In other words, it is spitting out an {excerpt} where the {exp:search:keywords} variable is. Ideas???

    Very odd!

    Thanks!

  • #2 / Jan 22, 2011 5:53pm

    Greg Salt

    3988 posts

    Hi Julie,

    I can’t replicate this error in my local installation of EE version 1.7.0. Which version and build of EE are you using for this installation? You can’t really use the tag like this because essentially you are nesting the search tags. What you might consider is outputting the search keywords somewhere else in your template and then repopulating the search field with that value using Javascript.

    Cheers

    Greg

  • #3 / Jan 22, 2011 7:31pm

    julie p

    282 posts

    Thanks, Greg. Not sure why I didn’t just do that myself. Must have been a Friday 😝

    The system is 1.6.9 and I ended up just using some php:

    <?php $searchKeywords = "{exp:search:keywords}"; ?>

    and…

    <input type="text" class="text" name="keywords" id="keywords" value="<?= $searchKeywords; ?>" />

    Julie

  • #4 / Jan 24, 2011 2:23am

    John Henry Donovan

    12339 posts

    Glad you found a solution. Feel free to start a new thread if you have any more questions

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

ExpressionEngine News!

#eecms, #events, #releases