Commit c40af944 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#193274 by dmitrig01 and quicksketch: send submit button data with AHAH submissions

parent 8ebc345b
......@@ -1614,7 +1614,6 @@ function expand_radios($element) {
*/
function form_expand_ahah($element) {
static $js_added = array();
// Add a reasonable default event handler if none specified.
if (isset($element['#ahah']['path']) && !isset($element['#ahah']['event'])) {
switch ($element['#type']) {
......@@ -1643,13 +1642,14 @@ function form_expand_ahah($element) {
drupal_add_js('misc/ahah.js');
$ahah_binding = array(
'url' => url($element['#ahah']['path']),
'event' => $element['#ahah']['event'],
'wrapper' => empty($element['#ahah']['wrapper']) ? NULL : $element['#ahah']['wrapper'],
'url' => url($element['#ahah']['path']),
'event' => $element['#ahah']['event'],
'wrapper' => empty($element['#ahah']['wrapper']) ? NULL : $element['#ahah']['wrapper'],
'selector' => empty($element['#ahah']['selector']) ? '#'. $element['#id'] : $element['#ahah']['selector'],
'effect' => empty($element['#ahah']['effect']) ? 'none' : $element['#ahah']['effect'],
'method' => empty($element['#ahah']['method']) ? 'replace' : $element['#ahah']['method'],
'progress' => empty($element['#ahah']['progress']) ? array('type' => 'throbber') : $element['#ahah']['progress'],
'button' => $element['#type'] == 'submit' ? array($element['#name'] => $element['#value']) : FALSE,
);
// Convert a simple #ahah[progress] type string into an array.
......
......@@ -43,6 +43,8 @@ Drupal.ahah = function(base, element_settings) {
this.effect = element_settings.effect;
this.method = element_settings.method;
this.progress = element_settings.progress;
this.button = element_settings.button || { };
if (this.effect == 'none') {
this.showEffect = 'show';
this.hideEffect = 'hide';
......@@ -70,6 +72,7 @@ Drupal.ahah = function(base, element_settings) {
var ahah = this;
var options = {
url: ahah.url,
data: ahah.button,
beforeSubmit: function(form_values, element_settings, options) {
return ahah.beforeSubmit(form_values, element_settings, options);
},
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment