I'm trying to pass some information from one page to the next, in a hidden field. And I need to be able to tweak it with jQuery; so I can't just use a pure Stash solution. But for some reason the value of my hidden field is converted from my simple flags (product or blog) to a long string of alphanumerics.

Here's the full template:

{exp:stash:get name="search_type" output="yes" dynamic="yes"}<br/>
{if '{exp:stash:search_type}' != 'product' && '{exp:stash:search_type}' != 'blog'}
{exp:stash:set_value name="search_type" value="product" replace="yes"}
{!-- exp:stash:set_value name="search_type" value="product" replace="yes" --}
<h1 class="searchTitle"><span class="icon"></span>search</h1>   
 <h4 class="links">
 <a id="prodsearch" {if '{exp:stash:search_type}' == 'product'}class="selected"{/if} href="ourtoys/search_results">product</a> | 
 <a id="blogsearch" {if '{exp:stash:search_type}' == 'blog'}class="selected"{/if} href="ourtoys/search_results">blog</a>

{exp:search:simple_form channel="products" form_class="form-wrapper cf"
result_page="ourtoys/search_results" no_result_page="ourtoys/no_search_results" where="any"}
<input type="hidden" name="search_type" id="search_type" value="{exp:stash:search_type}" />
<input type="text" name="keywords" class="keywords" placeholder="Search here..." required value="{exp:search:keywords}">
<button type="submit" id="search_button">go</button>

Interestingly, when I display the Stashed var inside the (search) form it's converted. But when I display it outside, it's the straight goods.

So my questions are:

  • why is this being converted?
  • how do I "read" or unconvert it?
  • is there some way to prevent them from being converted in the first place?
  • is there a mechanism for accessing stashed variables from JavaScript?
  • is there some other way to get JS-modified data from one page to the next?

I seriously doubt there'd be a JS access to Stash vars. But thought I'd ask just the same.

Thanks for your help.

2 Answers 2


Parse order is in play but one thing you could try is to add type="snippet" scope="user" save="yes" this will save it as traditional snippet, save to the current users session and save it across page loads. Maybe also after the get, decalre a new stash var to hold the result to rule out any gremlins.

Setting var to snippet : Then in your template you'd simple refer to the variable as {name_of_var} as a traditional snippet.

Then around your output (search form) try adding {exp:stash:parse process="end"} {/exp:stash:parse} to make sure all the stash stuff before completes before calling the results.

This all assumption based, your code is a little confusing to me at first glance, var is holding initially one value then HTML, opening stash without closing tags.


Could you show more of your code from that template?

The mix of alphanumeric characters have to do with ExpressionEngine parsing. Something is messed up, so it shows that.

Something, most likely Stash, or another plugin isn't being parsed correctly.

Edit: Have you tried to add parse="inward" to the exp:search:simple_form opening tag?


Your Answer

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

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