I'm using hook_form_alter()
to add some custom validations. I have to check if a date field is empty or not; when the field is empty, I need to display an error message.
I don't know how to get the value from date field after a form is submitted and check it with empty()
.
I have tried the following lines, but none of them worked.
$form_state['input']['field_start_date']['und'][0]['value']
$form['field_start_date']['und'][0]['#default_value']['value']
$form_state['values']['field_start_date']
What am I doing wrong?