After switching to the latest 7.x-3.0-alplha3 from 7.x-3.0-alplha2 I see that there is update of jQuery.form.js. What is different in jQuery.form.js v3? Problem is that after switching I have broken some AJAX callback called on form submit. I'm using this workaround:
PHP:
$form['actions']['submit'] = array(
'#type' => 'submit',
'#ajax' => array(
'callback' => 'webform_client_form_ajax_callback',
'wrapper' => str_replace('_','-',$form['#form_id']),
'effect' => 'fade',
),
'#value' => t('Submit'),
);
function webform_client_form_ajax_callback($form, &$form_state) {
$form_errors = form_get_errors();
drupal_get_messages();
if ($form_errors) {
$commands = array();
$error = isset($form_errors['submitted][parameters][subdomain']) ? $form_errors['submitted][parameters][subdomain'] : null;
$commands[] = array('command' => 'handleOrderAjaxForm', 'subdomainErrors' => $error, 'scroll' => true);
$page = array('#type' => 'ajax', '#commands' => $commands);
ajax_deliver($page);
} else {
return $form['#node']->webform['confirmation'];
}
}
JS:
Drupal.ajax.prototype.commands.handleOrderAjaxForm = function(ajax, response) {
alert('Hello');
};
and I have problem directly when I call ajax_deliver($page);. What's new or different? This technique which I'm using is described technique to call custom JS script on AJAX submit.
Note: before this update everything worked like a charm. My form is created using Webform module.
Comments
Comment #2
martinpesout commentedComment #3
JakeWilund commentedI can confirm I'm experiencing the same issue after updating to 7.x-3.0-alpha3
Comment #4
martinpesout commentedComment #5
William H. Olesen commentedThis update seemingly screwed up Overlays for me somehow.
I can't Edit a node by clicking on the Edit-tab below the Title - the page fades down, but no overlay appears.
When trying to close my Content list in Overlay by clicking the X in the top-right corner, it doesn't close anything, but does supply another scrollbar (that's in Firefox).
I've done nothing else than the update (I initially tried to role back on the core-update I just did as well, but that changed nothing)
I tried switching between the different Jquery-versions (1.4 is/was Drupalcore), but that did nothing.
I am - to say the least - surprised that an update can do this to a core-module.
EDIT: It was fortunately no problem for me to go back to my latest backup before the Jquery-update, and without that everything works properly again.
I'm guessing we can expect a new update pretty soon?
Comment #6
criscomI get a WSOD on /admin pages after updating to 7.x-3.0-alpha3. Reverting to 7.x-3.0-alpha2 didn't solve the problem.Sorry, the WSOD on admin pages was related to updating to Drupal 7.41.
Comment #7
martinpesout commentedI did a test but my mentioned problem isn't related to Drupal 7.41. Is it any way how can I help you with fixing of this bug? I don't know what's new in jquery.form.js v3. I've set AJAX form handler as you can see in my example and after form Submit I'll see alert window. Screenshot is attached to this post (sorry, my environment is in Czech).
Comment #8
slown commentedUp, i have same issue as William H. Olesen #5
What's the problem?
Thank you!
Comment #9
markhalliwellThe form plugin itself shouldn't have changed much (except structurally to support jQuery 1.5+). It could be that there is an issue with later jQuery versions, try enabling the jQuery Migrate plugin. I will need more information (e.g. JS console errors, if any) to help pin point what the actual issue is.
#5 & #8 are entirely separate issues and have absolutely nothing related to this issue, see #2507857: Remove 1.9 replacement files and #2597774: Force/suggest using migrate plugin when bbq or overlay JS is detected using jQuery 1.9+.
Comment #10
martinpesout commentedI did a small investigation and found a solution.
As you can see in issue description, I'm using
ajax_deliver($page);in my callback function. I've found that after switching to 7.x-3.0-alplha3 I need to removeajax_deliver($page);and callreturn $page;instead.Note: This call
return $page;didn't work in 7.x-3.0-alplha2.Comment #11
William H. Olesen commentedI just realised I've been a total ass concerning #5.
The problem is easily solved in the Jquery Update Configuration by selecting Default (Provided by Drupal) under "Alternate jQuery version for administrative pages".
Yeah, that was a real cracker and I'm an idiot :D
Comment #12
markhalliwellThis can be resolved by using the jQuery Migrate plugin as mentioned in #9.