Reputation: 157
I'm working with a typo3 installation. The Version 9.5.8. I have a search field on every page. When a value is entered into the field and the search button is clicked, I end up on the main search page (ID 255 in my case). On that page, the value that I searched for is displayed in the search field of the main search, but the search is not executed and no results are being displayed. The user has to click the search button again on that page in order to see any results. Why is the search not being executed?
My search field on every page consists of the following html code:
<form action="###URL###" id="tx_indexedsearch" method="post">
<fieldset>
<input type="hidden" name="tx_indexedsearch_pi2[__referrer][@controller]" value="Search">
<input type="hidden" name="tx_indexedsearch_pi2[__referrer][@action]" value="search">
<input class="tx-indexedsearch-searchbox-sword" id="tx-indexedsearch-searchbox-sword" type="text" name="tx_indexedsearch_pi2[search][sword]" value="###VALUE###" />
<input class="tx-indexedsearch-searchbox-button" id="tx-indexedsearch-searchbox-button-submit" type="submit" value="Search" name="tx_indexedsearch_pi2[search][submitButton]">
</fieldset>
What value do I need to send for the search to be executed?
Upvotes: 0
Views: 205
Reputation: 148
I don't understand your ###URL### but I wonder it's because of that it's not working.
Below a working example :
<form action='<f:uri.page pageUid="{settings.pidrecherc}?tx_indexedsearch_pi2[action]=search&tx_indexedsearch_pi2[controller]=Search" />' method="post" class="navbar-form navbar-right" role="search">
<f:form.hidden name="search[_sections]" value="0" />
<f:form.hidden name="search[_freeIndexUid]" id="tx_indexedsearch_freeIndexUid" value="_" />
<f:form.hidden name="search[pointer]" id="tx_indexedsearch_pointer" value="0" />
<f:form.hidden name="search[ext]" value="{searchParams.ext}" />
<f:form.hidden name="search[searchType]" value="{searchParams.searchType}" />
<f:form.hidden name="search[defaultOperand]" value="{searchParams.defaultOperand}" />
<f:form.hidden name="search[mediaType]" value="{searchParams.mediaType}" />
<f:form.hidden name="search[sortOrder]" value="{searchParams.sortOrder}" />
<f:form.hidden name="search[group]" value="{searchParams.group}" />
<f:form.hidden name="search[languageUid]" value="{searchParams.languageUid}" />
<f:form.hidden name="search[desc]" value="{searchParams.desc}" />
<f:form.hidden name="search[numberOfResults]" value="{searchParams.numberOfResults}" />
<f:form.hidden name="search[extendedSearch]" value="{searchParams.extendedSearch}" />
<div class="form-group">
<f:form.textfield name="tx_indexedsearch_pi2[search][sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="form-control input-lg" placeholder="Rechercher..." />
</div>
</form>
Here the important stuff are :
<form action='<f:uri.page pageUid="{settings.pidrecherc}?tx_indexedsearch_pi2[action]=search&tx_indexedsearch_pi2[controller]=Search" />' method="post"
and :
<f:form.textfield name="tx_indexedsearch_pi2[search][sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="form-control input-lg" placeholder="Rechercher..." />
"{settings.pidrecherc}" is my custom settings for the pid of the page where plugin is instanciated.
Also verify if you Typoscript setup enable indexing with :
config.index_enable = 1
Upvotes: 0