Hook_form_FORM_ID_alter problems with custom validating I have created a custom module for altering the user_register_form and with custom validating I have an error:
Notice: Undefined index: values in custom_register_validate_password() (line 17

This is the 17 line:

if (in_array($form['values']['pass'], $badpasswords)) {


I cannot understand what I'm doing wrong. Here's the full code:

&lt;?php

    /*
     * Implements hook_form_FORM_ID_alter().
     */
    function custom_register_form_user_register_form_alter(&amp;$form, &amp;$form_state, $form_id) {

        $form['#validate'][] = 'custom_register_validate_password';
        //krumo($form);
     }

     /*
      * Custom password validation
      */
    function custom_register_validate_password($form, &amp;$form_state) {
        $badpasswords = array('pass','password');
        if (in_array($form['values']['pass'], $badpasswords)) {
            form_set_error('pass', t('Please use a more secure password!'));
        }
        krumo($form_state);
    }
I think you need to write

    if (in_array($form_state['values']['pass'], $badpasswords)) {
        form_set_error('pass', t('Please use a more secure password!'));
    }


$form_state['values']['pass'] instead of $form['values']['pass']