Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the user get the error: "You must include at least one positive keyword with 3 characters or more."
Then if the user enters another search text that is bigger and press search then the user get the same error and it shows the previous search text.
Comment | File | Size | Author |
---|---|---|---|
#11 | error.png | 5.62 KB | Munavijayalakshmi |
#2 | form-error-cant-submit-again-2250105-2.patch | 1.53 KB | yingtho |
Comments
Comment #1
yingtho CreditAttribution: yingtho commentedComment #2
yingtho CreditAttribution: yingtho commentedSee attached patch to fix it. It properly could be done more correctly but at the moment I can't see a better way.
Comment #3
yingtho CreditAttribution: yingtho commentedChange status.
Comment #4
jdanthinne CreditAttribution: jdanthinne commentedPatch seems ok, but I'd like to find where does this bug comes from at the first place… Are you using the default search block, or a custom block?
Comment #5
yingtho CreditAttribution: yingtho commentedI'm using the default custom search block from custom search block module. (I have only one block)
Comment #6
markgifford CreditAttribution: markgifford commentedJust chiming in to say I can't reproduce this error with a custom search block - Custom Search 1.16, core 7.27.
When I type two characters in the search field, hit enter and I get the "You must include at least one positive keyword with 3 characters or more" message. Add a couple of characters so the search term is at least 3, hit enter, and I just get no results, no warning message as expected.
Comment #7
yingtho CreditAttribution: yingtho commentedDo you have translation enabled and multilingual content when you test?
Comment #8
markgifford CreditAttribution: markgifford commented@yingtho: no, neither
Comment #9
rebecca904 CreditAttribution: rebecca904 commentedThis patch works well for me to clear the error message of the keyword limits. Thanks, yingtho.
The search form on the result page is the default search not the custom search, if you enter more than 3 characters, it will get no warning message. But if you write a new custom search form on the result page by yourself, it will need you to clear the error message first and then to work.
Comment #10
rebecca904 CreditAttribution: rebecca904 commentedThe $language in the patch is not enough, it only gets the current language. We should consider if "current language and language neutral" is selected in "Search content from".
I changed as below:
// Add language if custom search i18n is included.
if (module_exists('custom_search_i18n'))
{
$i18n_search_language = variable_get('custom_search_i18n_search_language', 'all');
if ($i18n_search_language == 'current') {
$keys = search_expression_insert($keys, 'language', i18n_language()->language);
}
elseif ($i18n_search_language == 'current_neutral') {
$keys = search_expression_insert($keys, 'language', i18n_language()->language . ',und');
}
$q[count($q) - 1] .= $keys;
}
Comment #11
Munavijayalakshmi CreditAttribution: Munavijayalakshmi at Valuebound commentedError in the posted image is not coming after applying the patch. Patch is working fine, moving to RTBC.
Comment #12
Munavijayalakshmi CreditAttribution: Munavijayalakshmi at Valuebound commented