I have a multistep form with two submit handlers (save/submit), when "Save" is clicked I want to remove any validation applied to the node and have it's contents saved.
In my custom validation hook I am checking both the triggering_element and clicked_button for the correct button, I'm then removing limit_validation_errors however this doesn't work. According to the api documentation it should though.
function test_workflow_form_validate($form, &$form_state) {
if ($form['#form_id'] != 'test_application_assessment_form') {
if ($form_state['triggering_element']['#value'] == 'Save') {
$form_state['triggering_element']['#limit_validation_errors'] = array();
$form_state['clicked_button']['#limit_validation_errors'] = array();
$form_state['buttons'][1]['#limit_validation_errors'] = array();
// Remove validation.
}
else {
// Add in default validation.
//$node = (object) $form_state['values'];
//node_validate($node, $form, $form_state);
//entity_form_field_validate('node', $form, $form_state);
}
}
}
I've removed the default node validation so my custom one is the only one present. Is there something else I'm missing?
$form['#form_id'] !=
?! Are you sure it shouldn't be==
there? Just asking, as it looks like a typo in code.