Drupal.Dialog.submitAjaxForm runs replace on the URL but doesn't actually use the value. Since most forms submit to / it wasn't obvious. Since I'm touching it I used the same regex that Earl is using in ctools.

I also realized we make multiple calls to $(this) that could be avoided so I fixed that too.

CommentFileSizeAuthor
#7 dialog_1046758.patch570 bytesdrewish
dialog_urls.patch931 bytesdrewish

Comments

dave reid’s picture

Status: Active » Needs work
+++ dialog.js	31 Jan 2011 21:19:36 -0000
@@ -108,11 +108,11 @@
-      url.replace('/nojs/', '/ajax/');
+      url = url.replace(/\/nojs(\/|$)/g, '/ajax$1')
 
       var ajaxOptions = {
         type: 'POST',

Needs to use /\/nojs(\/|$|\?|&|#)/g, '/ajax$1' to match D7 core's ajax.js.

Powered by Dreditor.

drewish’s picture

But this issue is for D6...

drewish’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs work » Patch (to be ported)

Committed to 6.x, kicking this over to 7.x for review. Make sure to look at Dave Reid's comment in #1.

dave reid’s picture

BTW, #1 is how ctools for D6 also uses it.

drewish’s picture

Dave Reid, I think you might be mistaken. I just double checked and CTools DRUPAL-6--1 uses the regex I used in this path: http://drupalcode.org/viewvc/drupal/contributions/modules/ctools/js/ajax...

While searching around I came #970536: nojs/ajax replacement fails in various situations which backports the D7 version to D6. I like that it centralizes the regex into a function so I could call it.

dave reid’s picture

Hah, damnit, I had it applied locally... :)

drewish’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Patch (to be ported) » Needs review
StatusFileSize
new570 bytes
eugenmayer’s picture

Just referencing #1151236: Code dublication of ctools Drupal.CTools.AJAX.ajaxSubmit as we could fix the bug in dialog by properly utilizing ctools as a lib

devin carlson’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Dialog 6.x is no longer supported.