0

I'm trying to get a simple search form to work. But I get an error: The action you have requested is invalid.

I have no idea what I'm missing here.

Stash partial with search form:

<section>
            {exp:search:simple_form channel="blog" search_in="everywhere" result_page="blog/search"}
            <h2><label for="search">Search</label></h2>
            <div class="searchField">
                <input type="text" name="keywords" id="search" value="" size="18" maxlength="100">
                <button type="submit">Go!</button>
            </div> <!-- /.searchField -->
            {/exp:search:simple_form}
        </section>

Stash viewmodel for search results:

{stash:embed:layouts:blog}

{exp:stash:set name="body_class"}blog{/exp:stash:set}

{exp:stash:set_list name="detail_data" parse_tags="yes" parse_depth="2"}

    {exp:search:search_results}

        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {stash:excerpt}{excerpt}{/stash:excerpt}
        {stash:author}{author}{/stash:author}
        {stash:post_date}{entry_date format='%M %d, %Y'}{/stash:post_date}

    {/exp:search:search_results}

{/exp:stash:set_list}

This makes no difference. /TEMP/ $config['secure_forms'] = "n";

I hope someone can help me out! Thanks!

1
  • Do you have other problems with secure forms? For instance, can you submit comments? If you are on a corporate firewall that heavily caches URLs, your request could include an expired CSRF token. May 13, 2014 at 5:32

3 Answers 3

1

Newer versions of ee have more strict security requirements for post data. Try adding the following to your form:

<input type="hidden" name="XID" value="{XID_HASH}" /> 

(This is an older question but I am adding this as it a common resolution to these sorts of problems.)

0

Have you installed the "Search" add-on?

Had the same issue, but the search module wasn't installed.

1
  • Hmmm, no the search module is installed. Apr 11, 2014 at 17:59
0

I had a very similar issue, and it seemed to amount to the {exp:search:search_results} tag being inside a Stash tag.

So I flipped it inside out and used {exp:stash:append}(or append_list in your case) inside of the search_results tag.

3
  • Hmm, no. That doesn't do it either. Apr 13, 2014 at 15:01
  • Ok. One last guess. Do you have your no_result_page="" parameter set to the same template as the result_page="" parameter? Apr 14, 2014 at 0:20
  • Hmm, well. no_result_page set to the same gives me a blank page. Set to something else gives met the error again. Strange issue this one. Apr 14, 2014 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.