summaryrefslogtreecommitdiff
path: root/modules/search/search.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/search/search.module')
-rw-r--r--modules/search/search.module10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/search/search.module b/modules/search/search.module
index 1f4238797..027643485 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -1036,6 +1036,16 @@ function search_box_form_submit($form, &$form_state) {
unset($_GET['destination']);
}
+ // Check to see if the form was submitted empty.
+ // If it is empty, display an error message.
+ // (This method is used instead of setting #required to TRUE for this field
+ // because that results in a confusing error message. It would say a plain
+ // "field is required" because the search keywords field has no title.
+ // The error message would also complain about a missing #title field.)
+ if ($form_state['values']['search_block_form'] == '') {
+ form_set_error('keys', t('Please enter some keywords.'));
+ }
+
$form_id = $form['form_id']['#value'];
$info = search_get_default_module_info();
if ($info) {