Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a node add form in a overlay, that is submitted using AJAX.

Is there any way to return node edit form as ajax response once you add the node?. I have tried with drupal_build_form in the custom submit handler, but resulted with error. The code sample as follows:

$form['actions']['submit']['#ajax'] = array(
          'callback' => 'mymodule_node_form_js_submit',
          'wrapper' => 'my-node-form',
          'method' => 'replace',
          'effect' => 'fade',
          ); 


function mymodule_node_form_js_submit($form, &$form_state) {
    $node = $form_state['node'];

    if (isset($node->nid)) {
        return drupal_build_form('my_node_form',$node);
    }
    return $form;
}
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.