Created a search box that was (a) restricted to a single content type, and (b) had two taxonomy vocabularies configured with checkboxes and the -all- option. Configured to show results on the same page.

The issues: all searches generate a warning, and secondly, if you forget to enter any keywords you will break the form (even subsequent searches will return the same errors despite valid keywords being submitted).

First: anytime a search is performed, the following notice is displayed:

Notice: Undefined index: custom_search_blocks_form_2 in custom_search_submit() (line 381 of [path to contrib modules directory]/custom_search/custom_search.module).

Second: if you try a search without including any keywords, you will get the following notices:

Notice: Undefined variable: keys in custom_search_form_alter() (line 155 of [path to contrib modules directory]/custom_search/custom_search.module).
Warning: implode(): Invalid arguments passed in implode() (line 155 of [path to contrib modules directory]/custom_search/custom_search.module).

If you then try to enter keywords and try your search again, it will fail (no results), and show the above errors again, along with the error notice that one would expect if no keywords had been included:

You must include at least one positive keyword with 3 characters or more

After comparing settings with another block that is not giving errors, have found that the issues only happen when the setting "Search box input type" is set to the default "text", changing this to "search (HTML5)" appears to resolve all issues.

I was on a deadline so I apologize for not doing any more testing than that. I marked as Major since "text" is the default value and the form is basically not usable while it is selected. Not critical though since the option "search (HTML5)" appears to work fine.

Comments

jdanthinne’s picture

Status: Active » Needs review

I was assigning the wrong default input type to the search box. Just changed it from "text" to "texfield" and everything seems ok now…
Can you confirm that by using this patch : http://drupalcode.org/project/custom_search.git/patch/f79e0f4
Make sure you re-save the block settings after applying the patch.

freeform.steph’s picture

Thank you for your speedy response!

I have tested against dev release 7.x-1.13+5-dev and it appears to have resolved the issue - thanks!

freeform.steph’s picture

Question, I'm not sure if this is a separate issue, or if it is functioning as designed - when the form was broken, if you left the keyword box empty, a warning box displayed saying "You must include at least one positive keyword with 3 characters or more", now that the reported issues are resolved, if you leave the keyword field empty it no longer gives a warning, it simply highlights the box red, which is fine for most people, but is an accessibility issue for those who use a screen reader or have a colour-vision impairment.

jdanthinne’s picture

The original behavior was to highlight to field instead of redirecting to an error page, but if you think that it is more accessible-friendly to do the redirect, I can do that instead… just tell me what's the best solution.