I have a problem using #limit_validation_errors for a submit button on which I dont want all the validations to run. Here's my custom submit button :
$form['actions']['draft'] = array(
'#type' => 'submit',
'#value' => 'Save as draft',
'#submit' => array(''),
'#limit_validation_errors' => array(
array('title'), // Validate $form_state['values']['title'].
),
);
It works perfectly in the sense that it checks the validation on the title field only, but the weird thing is, it does not submit any other field's values when submitted. I wrote a custom submit handler to check that. However, the values are present in $form_state['input']
but not in $form_state['values']
.
What I want simply is, this form will submit with just the values given and overlook the validations when this custom submit button is clicked.
FYI : I can get $form_state['values']
perfectly in my custom validate function.
Any ideas? What am I doing wrong here?