I'm using a custom block to search using faceted search and need some help. I've been using the code below to make an initial faceted search - this creates a search box which always appears at the top of the page. It only makes new searches and doesn't search within the results - this is done by the standard faceted keyword search block which then appears on the search results page.
I've just noticed that although the custom search block works fine on my local site, on my remote server it fails to work if a user is logged in - and only then, the error returned is below:
'Validation error, please try again. If this error persists, please contact the site administrator.'
Here is the code for the custom block i'm using:
if ($delta == 0){
$block['subject'] = '';
$block['content'] = '
<form action="/faceted_search/select" method="post" id="loginbar-faceted-search-ui-form">
<div id="searchbar-top">
<input type="text" maxlength="255" name="and" id="edit-and" size="20" value="Get Headhunting" onfocus="clearDefault(this)" class="form-text" />
<label class="questionmark"><a href="/help">?</a></label>
</div>
<input type="hidden" name="stage" id="edit-stage" value="results" />
<input type="hidden" name="style" id="edit-style" value="extract" />
<input type="hidden" name="sort" id="edit-sort" value="relevance" />
<input type="hidden" name="facet-key" id="edit-facet-key" value="" />
<input type="hidden" name="facet-id" id="edit-facet-id" value="" />
<input type="hidden" name="facet-sort" id="edit-facet-sort" value="" />
<div id="searchbar-submit">
<input type="submit" name="op" id="edit-submit" value="Search" class="form-submit" />
</div
<input type="hidden" name="form_token" id="edit-faceted-search-ui-form-form-token" value="' . drupal_get_token('faceted_search_ui_form') . '" />
<input type="hidden" name="form_id" id="edit-faceted-search-ui-form" value="faceted_search_ui_form" />
<div id="browse-button"><a href="/faceted_search/select/-/-/extract/relevance/">Browse</a></div>
</form>
';
}
I'd rather do this in a more drupal way and reuse some of the faceted search module's form code, but i'm not quite sure how.
You can see the search box in action here: http://www.01am.co.uk
Any ideas
Comments
Comment #1
David Lesieur commentedJust tried your link and did not get any error. Did you manage to fix it?
Comment #2
amcc commentedjust managed to fix it - had a missing
within a form which seemed to throw the search but only when logged in - so i think it was the problem. Though the question still stands about how to do the above in a more drupal way - ie building a custom form that can submit faceted searches
Comment #3
David Lesieur commentedThat is another matter... ;) Pro Drupal Development is a good start if you'd like to learn how to build forms (and much more) with Drupal.
Cheers,
David.
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
amcc commentedHeres the code for my facet search block, the problem as i mentioned above was a missing
I think
Stick this in your block code and you'll have a little faceted search box:
Comment #6
svnindia commentedHow to place a facetsearch text box in a search form, where users can type/input as title:search
Is there any moduels or need to write a custom module
I am integrating with elasticsearch..