Validating node creation / edit form I'm using form_alter to play with the node form for a specific content type. This content type has many different fields and I'm also using Field Collection module to organize all these fields &amp; logic, if that makes any difference.

Apparently, there are some incompatibilities between the Field Collection &amp; Field Dependencies modules so I thought I might be able to build a similar field dependency functionality with my own module.

I've created a validation function for the form. My problem is that I'm trying to access $form_state values that users insert in the form in order to validate these values but I think I'm doing something totally wrong here:

function _mymodule_my_validation_function($form, &amp;$form_state){
    $short_field_name = $form_state['values']['long_field_name'];
    if (empty($short_field_name) || $$short_field_name == '') {
        form_set_error('error','That field cannot be empty!');
    }
}


Unfortunately this validation script doesn't work. To be more exact, I

dpm($form_state);


in my form_alter and $form_state doesn't even contain 'values' (shouldn't it be present but empty?).

Is there a different best practice for validation node form fields instead of dealing with the $form_state['values'] array?

Also, I need to be able to see the values submitted by users each time the node form is submitted. Currently, I dpm($form) in my form_alter function and everything is returned on the node/%/edit page as expected. But how can I catch submitted values on the node/% page after submitting the node form??

Update:
When I call dpm($form_state) within my validation function I get what I need if the form doesn't validate (as we still are on the same node edit page). But how can I receive the (new/changed) values that users entered in the form fields in case the form is submitted successfully and user is directed to content list page?
For custom forms
The preferred way is to call hook_form_validate for hook_form but you can use $form['#validate'][] = 'custom_validate_function' to call validate function

function hook_form(&amp;$form,&amp;$form_state,$form_id) {

$form = array();

// write your custom fields here..........
return $form;

}

function hook_form_validate($form, &amp;$form_state) {
 $short_field_name = $form_state['values']['long_field_name']['und'][0]['value'];
    if (empty($short_field_name) || $short_field_name == '') {
        form_set_error('long_field_name','That field cannot be empty!');
    }

}


For built in forms by creating content type

function hook_form_alter($form, &amp;$form_state, $form_id) {
  if ($form_id == 'your_form_id') {
    $form_state['#validate'][] = 'form_1_validate';
    $form_state['#submit'][] = 'form_1_submit';
  }
}

function form_1_validate($form, &amp;$form_state) {

$short_field_name = $form_state['values']['long_field_name']['und'][0]['value'];
    if (empty($short_field_name) || $short_field_name == '') {
        form_set_error('long_field_name','That field cannot be empty!');

}
}

function form_1_submit($form, &amp;$form_state) {

//To get the user selected or user submitted values you should look into code below
$field_name_values = $form_state['values']['field_name'];



}