Forums / Developer / Submit error / Comment51660

Author Topic

André R.

Saturday 29 August 2009 4:47:15 am

Comment51660

I think there are several mistakes done here.
1. post values won't be set before on the next page, so you'll need to click on the search button one more time if the code even works
2. POST and GET variables is not handled by the cache system in Exponential by default, only view parameters ( the ones you see in the url when you for instance paginate, like /Something/(offset)/20 )

So this should be handled by javascript (onclick) like this:

<form action={"/content/search"|ezurl}>
<select name="Estado" id="search-selection-estado">
<option selected="selected">RJ</option>
</select>

<select name="Cidade" id="search-selection-cidade">
<option selected="selected">Niterói</option>
</select>

<input type="hidden" name="SearchText" value="{$SearchText}" id="search-text" />

<input id="searchbutton" class="button" type="submit" value="{'Search'|i18n('design/ezwebin/pagelayout')}" alt="{'Search'|i18n('design/ezwebin/pagelayout')}" onclick="var est = document.getElementById('search-selection-estado'), cid = document.getElementById('search-selection-cidade'), searchTxt = document.getElementById('search-text');searchTxt.value = est.value + ' ' + cid.value;" />
</form>

Not tested, you might have to change 'onclick' to 'onkeydown' or something, don't remember the event order when it comes to onclick vs onsubmit right now.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom