You are here

function shoutbox_add_form_validate in Shoutbox 5

Same name and namespace in other branches
  1. 6.2 shoutbox.module \shoutbox_add_form_validate()
  2. 6 shoutbox.module \shoutbox_add_form_validate()
  3. 7.2 shoutbox.module \shoutbox_add_form_validate()
  4. 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 820
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_id, $form_values) {
  if ($form_values['nick'] == t('Your Name/Nick') || $form_values['message'] == t('Enter Message')) {
    form_set_error('', t('Default values are not acceptable'));
  }
  if ($form_values['nick'] == '' || $form_values['message'] == '') {
    form_set_error('', t('You must enter a nick and a message.'));
  }

  // URL is optional.
  if ($form_values['url'] == t('Your Website URL')) {
    $form_values['url'] = '';
  }
}