Form generating multiple notices when search box input type is set to 'text', and breaks completely if no keywords included in search

Created on 3 December 2013, almost 12 years ago
Updated 9 May 2025, 5 months ago

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.

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Blocks submodule

Created by

πŸ‡¨πŸ‡¦Canada freeform.steph

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024