Hi Derek,
We are occasionally getting this error as some uses submit a search:
The following errors were encountered
This form has expired. Please refresh and try again.
Return to Previous Page
We are currently using version 1.1.4 of Google Custom Search with version 2.8.0 of Expression Engine.
Our code to call upon Google Custom Search is as follows:
{exp:google_custom_search:form results_page="search/results" id="search-form" class="form-search" honeypot="y" snaptcha="n"} <div class="input-append"> <input type="text" name="keywords" id="keywords" placeholder="Search" required class="search-query"><!-- Fix Gap --><button type="submit" value="submit" class="btn">Search</button> </div> {/exp:google_custom_search:form}
On a separate results template file we have:
{exp:google_custom_search:form results_page="search/results" id="search-form" class="form-search" honeypot="y"} <div class="input-append"> <input type="text" name="keywords" id="keywords" placeholder="Search" value="" class="span6 search-query"> <button type="submit" value="submit" class="btn">Search</button> </div> {/exp:google_custom_search:form}
And then the actual results code, located on the same page as above:
{exp:google_custom_search:results cse="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" keywords="{segment_3}"} {if no_search_results}<p>Sorry, your search returned no results.</p>{/if} {if search_results} <h2>{total_search_results} result{if total_search_results != 1}s{/if} for “{keywords}”</h2> <hr class="dotted"> <ul class="unstyled"> {results} <li class="search-result-item {format}"> <article> <h3><a href="{url}">{title}</a></h3> <small>{url}</small> <p>{excerpt}</p> </article> </li> {/results} </ul> {if pagination} <hr class="dotted"> <section class="pagination center"> <ul> {if previous_page} <li><a href="{previous_page}">Previous Page</a></li> {/if} <li class="disabled"><a href="#">Page {current_page} of {total_pages}</a></li> {if next_page} <li><a href="{next_page}">Next Page</a></li> {/if} </ul> <p>Showing results: {current_results_start} - {current_results_end} of {total_search_results}</p> </section> {/if} {/if} {/exp:google_custom_search:results}
This error only shows up every once in a while, but it has happened enough that many users have reported it, and others have said that they just don’t use our search anymore and consider it broken.
I will continue investigating and report back with any updates here. My first guess is that this has something to do with caching and the csrf_token being invalid. Another possibility is the Stash plugin somehow, maybe, stashing the token and causing an error? The problem with that theory is that this error isn’t consistent, so it cant be that simple. I will also update to the latest version of 1.1.5 to see if that has any effect too.
Please let me know if you have any suggestions.
Thank you!
|