Hi,

Today I've been testing the Dialog module in a new site I'm working on. I've review the example modules and the module implementation and it's fits pretty well my requirements. However, I've a problem I don't know how to solve.

When creating an AJAX display command in order to open a dialog you can set options like 'width', 'height', 'closeOnEscape', etc. When testing the 'buttons' option, in order to add some buttons to the jQuery dialog attached to submit buttons in a form included in the dialog contents, I found the problem.

The 'click' property for the dialog buttons is a JS callback function. That's the first problem: when the JSON is generated using the drupal_json_output, the callback functions are not correctly rendered. That's annoying, but I implemented a workaround based on this post. Now the JSON is correctly generated, but on the client side an AJAX 'parsererror' is raised.

So, is there any recommended way of adding buttons to a dialog and set the behaviour of those buttons adding JS for the click event?

Thank you! :)

CommentFileSizeAuthor
#3 buttons.patch2.03 KBrobloach
#1 buttons.patch1.81 KBrobloach

Comments

robloach’s picture

Title: Adding buttons and click callbacks to dialogs » Add the submit action buttons to the Dialog
Category: support » feature
Status: Active » Needs work
StatusFileSize
new1.81 KB

The click event doesn't invoke the submit button for some reason. Maybe need to change to submit?

jantimon’s picture

The Drupal ajax frameworks does not use 'click' but 'mousedown'.

However this can be changed for every form element.

misc/ajax.js
// Bind the ajaxSubmit function to the element event.
$(ajax.element).bind(element_settings.event, function (event) {
return ajax.eventResponse(this, event);
});
robloach’s picture

StatusFileSize
new2.03 KB

Not sure if it's working yet.

nagiek’s picture

Status: Needs work » Needs review

Setting status for the bot :)

yannickoo’s picture

Status: Needs review » Needs work

This module doesn't contain any tests so you don't have to change the status for the bot ;)

The patch moves the buttons correctly but nothing happens when clicking on a button, we should work on this, right?

devin carlson’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

The 7.x-1.x branch of the Dialog module is unsupported.