Closed (fixed)
Project:
Webform Ajax Submit
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
8 May 2012 at 20:49 UTC
Updated:
23 Dec 2013 at 14:15 UTC
Jump to comment: Most recent
As an admin user, when visiting the webform node type creation or edit forms with this module enabled, array_key_sxists() is throwing an error if there are no nid's in the variable_get() return.
To fix, I rearranged your hook_form_alter():
<?php
/**
* Implements hook_form_alter().
*/
function webform_ajax_submit_form_alter(&$form, &$form_state, $form_id) {
// Apply only to nodes from settings.
$nodes = unserialize(variable_get('webform_ajax_submit', ''));
if (isset($form['#node']->nid) &&
$nodes[$form['#node']->nid] == TRUE &&
$form_id == 'webform_client_form_' . $form['#node']->nid) {
if (is_array($nodes) && array_key_exists($form['#node']->nid, $nodes)) {
$form['actions']['submit']['#ajax'] = array(
'callback' => 'webform_ajax_submit_ajax_callback',
'wrapper' => str_replace('_', '-', $form['#form_id']),
);
// Custom submit handler for webform submission.
$form['#submit'][] = 'webform_ajax_submit_ajax_form_submit_redirect';
}
}
elseif ($form_id == 'webform_configure_form') {
$form['submission']['redirection']['redirect']['#options']['none_ajax'] = t('No redirect - Use AJAX');
// We have to insert our submit before webform's submit runs to allow handling of
// newly added radio #option.
// Custom submit handler for webform configuration page submission.
array_unshift($form['#submit'], 'webform_ajax_submit_ajax_form_submit_config');
}
}
?>
Comments
Comment #1
alex.skrypnykFixed in 7.x-1.1
Comment #2
alex.skrypnykComment #3
alex.skrypnyk