diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-05-16 11:17:41 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-05-16 11:17:41 +0000 |
commit | ecd7cfed480f18f76072e556a1f99d4c40cb6334 (patch) | |
tree | ef88bd427c916a0252c02919addaedd3a4160541 /modules/contact | |
parent | 85cbb1be6e5914950bffb1cda764c6f0b9d71f7e (diff) | |
download | brdo-ecd7cfed480f18f76072e556a1f99d4c40cb6334.tar.gz brdo-ecd7cfed480f18f76072e556a1f99d4c40cb6334.tar.bz2 |
- Improvement: avoid people hitting 'Send message' without checking the category/subject.
Diffstat (limited to 'modules/contact')
-rw-r--r-- | modules/contact/contact.module | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 01c4176ef..859662f2c 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -237,7 +237,10 @@ function contact_mail_page() { if (!$edit['message']) { form_set_error('message', t('You must enter a message.')); } - + if (!$edit['subject']) { + form_set_error('subject', t('You must select a valid subject.')); + } + if (!form_get_errors()) { // Prepare the sender: $from = $edit['mail']; @@ -285,6 +288,7 @@ function contact_mail_page() { } $result = db_query('SELECT subject FROM contact ORDER BY subject'); + $subjects[] = '--'; while ($subject = db_fetch_object($result)) { $subjects[$subject->subject] = $subject->subject; } @@ -293,7 +297,7 @@ function contact_mail_page() { $output = variable_get('contact_form_information', t('You can leave us a message using the contact form below.')); $output .= form_textfield(t('Name'), 'name', $edit['name'], 50, 255, NULL, NULL, TRUE); $output .= form_textfield(t('E-mail'), 'mail', $edit['mail'], 50, 255, NULL, NULL, TRUE); - $output .= form_select(t('Subject'), 'subject', $edit['subject'], $subjects); + $output .= form_select(t('Subject'), 'subject', $edit['subject'], $subjects, NULL, NULL, NULL, TRUE); $output .= form_textarea(t('Message'), 'message', $edit['message'], 70, 8, NULL, NULL, TRUE); $output .= form_submit(t('Send e-mail')); $output = form($output); |