I'm currently trying to set up a custom validation script to prevent spam on a comment form with hidden elements. The problem involves setting up the conditional for the submitted form values. I'm currently using the hook_form_FORM_ID_alter. Here is my existing code.
function STARTERKIT_form_comment_node_contact_page_form_alter(&$form, &$form_state) {
$form['#validate'][] = 'comment_validation_function';
}
function comment_validation_function($form, &$form_state)
{
if ($form_state['values']['field_website'] != 'http://') {
form_set_error('field_website', t('Please do not change the value of this field.'));
}
}
The problem is that $form_state['values']['field_website'] isn't returning the value inside the text field. I've looked at so many pages showing a script very similar to this, yet I haven't been able to get this even close to working.
The field id is "field_website".