Module for comment validation I'm learning how to create a new module for the first time, so please bare with me. I'm trying to add a validation on the comment form from scratch; it's just not validating at all, meaning that my form successfully submits when I intentionally don't fill out the subject field.
Here is my code:

/*
 *  Implementation of hook_form_alter
 */
function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id){
  if ($form_id == "comment_form") {
    $form['#validate'][] =  'my_module_comment_validate';
  }
}   

/**
  * Validate routine to prevent keywords from being used within comments.
  */
function my_module_comment_validate($form, &amp;$form_state){

if ($form_state['values']['subject'] == '') {
 form_set_error('', t('Error!'));
 }
}
In your form_set_error() call, you haven't set a specific field name on which to set an error. It's possible that without a form_set_error() call identifying a real form element no error is happening.

form_set_error('subject', t('Error!'));


Also, check to make sure your validation function is being called with a drupal_set_message()