If you're running into the JavaScript alert error message on creating an AJAXified node form:
Call to undefined function node_form_validate() ...
... the reason might be that the $form_states array contains wrong information which files to load on form build.
This may for example happen because the form determines this based on the parent page where the form is included.
In my specific case the solution was to override the value set with the one I really required:
if (empty($form_state['build_info']['files']) || !in_array('modules/node/node.pages.inc', $form_state['build_info']['files'])) {
form_load_include($form_state, 'inc', 'node', 'node.pages');
}
?>
Here's the full content of my HOOK_node_form_alter function:
function MY_MODULE_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
// Override build info to include the required node.pages.inc file, else Call to undefined function node_form_validate happens
if (empty($form_state['build_info']['files']) || !in_array('modules/node/node.pages.inc', $form_state['build_info']['files'])) {
form_load_include($form_state, 'inc', 'node', 'node.pages');
}
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#submit' => array('node_form_submit'),
'#ajax' => array(
'wrapper' => str_replace('_', '-', $form['#form_id']),
'callback' => 'MY_node_form_ajax_callback',
'method' => 'replace',
'effect' => 'fade'
)
);
}
?>
That's it. Error is gone.