Hi thanks for the module.

Im using auto modal to display the comment forms as popups.

This works when the comment form is set to be displayed on a seperate page, under comment settings on admin/conent/node-type. I created a view, added add new comment field, have a link to the nodes comment form, when the links clicked the modal opens up the comment form, post your comment click submit, form closes.

But, i needed the comment form to be on the same page as the node, so changed comment settings, edited the add new comment link, so now the hole node shows up in the modal box, but only the comment form is visable, now when a user posts the comment, the page refreshes in the modal popup but doesnt close.

I need to keep the comment form as part of the node not on a seperate page, do you know how I can get the window to close when the comments been sent?

Thanks for any suggestions.

CommentFileSizeAuthor
#5 automodal-921732.patch558 bytesmstef
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Oleksa-1’s picture

concider a Dialog API module it does exactly what you need

mstef’s picture

I have comments on a separate page with a button that opens the comment form in a modal - and I can't get that to close either. Seems like something is causing automodal_close_form_submit() to not be called - despite it being in the form's #submit..

Any ideas????

mstef’s picture

I found the problem..I just don't know how to fix it, or why it's happening, or what's causing it..etc

Replies to comments work fine - the modal closes

Replies to nodes do not work fine - the modal stays open and reloads itself..

The difference is, the reply to comments form has an #action that includes ?automodal=true&automodalClose=true (but how is that getting there?).

The reply to node form's #action is without queries...

????

mstef’s picture

Looks like the problem is in comment_form()

..

if (empty($edit['cid']) && empty($edit['pid'])) {
  $form['#action'] = url('comment/reply/' . $edit['nid']);
}
mstef’s picture

Version: 6.x-1.0-beta1 » 6.x-1.0
Status: Active » Needs review
FileSize
558 bytes

Patch

capellic’s picture

Status: Needs review » Reviewed & tested by the community

I have applied the patch in #5 and it's a life saver!

hefox’s picture

Status: Reviewed & tested by the community » Needs work

So the bug is basically if #action is set to a different page than the current page, modalframe breaks. This may fix the comment bug, but won't fix the general bug.

dsnopek’s picture

Title: comment form wont close if its on same page as node. » Won't close if #action is set to a different page than the current page
Category: Support request » Bug report
Issue summary: View changes

@hefox is right - this doesn't solve the general problem and feels a little hacky. I've changed the hook_automodal_close_args_alter() hook to allow you to abort the close. So, if you implement that hook in another module and simply include this code there:

function MYMODULE_automodal_close_args(&$args, $form, $form_state) {
   // If this is a comment form
   if ($form_id == 'comment_form') {
     unset($form['#action']); 
   }
}

That should help anyone solve any of the edge cases without having to hack the automodal code.

However, the general issue still needs to be resolved! So, I'm going to rename this issue for that.