I'm attempting to put a node form into a modal dialog. I've implemented hook_form_alter() in a custom module and added this to that hook:

function example_form_alter(&$form, $form_state, $form_id){
popups_add_popups();
print l("Add a story", 'node/add/story', array('attributes' => array('class' => 'popups-form')));
}

When I click this link in the browser I get the "loading" animation, but it repeats this animation forever without ever showing the dialog. If I change the path in the link to 'node/add', then the dialog box loads quickly and shows the node/add page.

Is it possible to use the popups module to display a node form inside of a dialog, and if so what am I missing here?

Thanks so much!
axlroach

Comments

starbow’s picture

Title: Form path not displaying in dialog » Add Content form in a popup
Status: Active » Fixed

Yes, I have tested it, and it is possible, but for best effect you should use the hook, not the class. Here is the rule I used:

    'popups/test' => array( // test.
      '#test-popup' => array( 
        'additionalJavascript' => array('misc/collapse.js'),
        'forceReturn' => 'node/add/story',
      ),
    ),

on this link:

  $output .= '<li>'. l("Add Story (hook).", 'node/add/story',
               array( 'attributes' => array('id' => 'test-popup')));// , 'class' => 'popups-form')));
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

fysalgates’s picture

how does a full code structure that solves this problem look like. i also have the same problem and need help.
thanks