function shoutbox_add_form_validate in Shoutbox 6
Same name and namespace in other branches
- 5 shoutbox.module \shoutbox_add_form_validate()
- 6.2 shoutbox.module \shoutbox_add_form_validate()
- 7.2 shoutbox.module \shoutbox_add_form_validate()
- 7 shoutbox.module \shoutbox_add_form_validate()
Makes sure uses don't submit default values.
Parameters
$form_id: The form ID of the form.
$form_values: Form values.
File
- ./
shoutbox.module, line 787 - shoutbox module displays a block for users to create short messages for thw whole site. Uses AHAH to update the database and display content.
Code
function shoutbox_add_form_validate($form, $form_state) {
if ($form_state['values']['nick'] == t('Your Name/Nick') || $form_state['values']['message'] == t('Enter Message')) {
form_set_error('', t('Default values are not acceptable'));
}
if ($form_state['values']['nick'] == '' || $form_state['values']['message'] == '') {
form_set_error('', t('You must enter a nick and a message.'));
}
// url is optional
if ($form_state['values']['url'] == t('Your Website URL')) {
$form_state['values']['url'] = '';
}
}