From my module test I render the create node form on URL admin/test using the following:

function test_menu() {
  return array(
    'admin/test' => array(
      'title' => 'test',
      'access callback' => '_test_access',
      'page callback' => '_test_render',
      'type' => MENU_LOCAL_TASK

function _test_access() {
  return true;

function _test_render() {
  module_load_include('inc', 'node', 'node.pages');
  $form = node_add('my_content_type');
  return array(
    'whatever' => array(
      '#type' => 'markup',
      '#markup' => drupal_render($form),

Form works well and can create a new node of type my_content_type. The problem is that some fields where ajax is involved give me the following error when pressing "Add Items":

Error: Call to undefined function node_form_validate() in form_execute_handlers() (line 1520 of /webapp/includes/form.inc).

enter image description here

The details of those fields are:

  • Field type: Entity Reference
  • Widget: View
  • View display type: Entity Reference View Widget

1 Answer 1


Solution can be found at Embed a "node add" form in a page. You have to implement hook_menu_alter() for ajax calls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.