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(&$form, &$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, &$form_state){
if ($form_state['values']['subject'] == '') {
form_set_error('', t('Error!'));
}
}
dpm
inside the validate function ? what is the output?