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

6.x
Gábor Hojtsy 2007-11-19 10:05:48 +00:00
parent 8ebc345b9d
commit c40af9443d
3 changed files with 10 additions and 8 deletions

View File

@ -1614,7 +1614,6 @@ function expand_radios($element) {
*/ */
function form_expand_ahah($element) { function form_expand_ahah($element) {
static $js_added = array(); static $js_added = array();
// Add a reasonable default event handler if none specified. // Add a reasonable default event handler if none specified.
if (isset($element['#ahah']['path']) && !isset($element['#ahah']['event'])) { if (isset($element['#ahah']['path']) && !isset($element['#ahah']['event'])) {
switch ($element['#type']) { switch ($element['#type']) {
@ -1643,13 +1642,14 @@ function form_expand_ahah($element) {
drupal_add_js('misc/ahah.js'); drupal_add_js('misc/ahah.js');
$ahah_binding = array( $ahah_binding = array(
'url' => url($element['#ahah']['path']), 'url' => url($element['#ahah']['path']),
'event' => $element['#ahah']['event'], 'event' => $element['#ahah']['event'],
'wrapper' => empty($element['#ahah']['wrapper']) ? NULL : $element['#ahah']['wrapper'], 'wrapper' => empty($element['#ahah']['wrapper']) ? NULL : $element['#ahah']['wrapper'],
'selector' => empty($element['#ahah']['selector']) ? '#'. $element['#id'] : $element['#ahah']['selector'], 'selector' => empty($element['#ahah']['selector']) ? '#'. $element['#id'] : $element['#ahah']['selector'],
'effect' => empty($element['#ahah']['effect']) ? 'none' : $element['#ahah']['effect'], 'effect' => empty($element['#ahah']['effect']) ? 'none' : $element['#ahah']['effect'],
'method' => empty($element['#ahah']['method']) ? 'replace' : $element['#ahah']['method'], 'method' => empty($element['#ahah']['method']) ? 'replace' : $element['#ahah']['method'],
'progress' => empty($element['#ahah']['progress']) ? array('type' => 'throbber') : $element['#ahah']['progress'], '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. // Convert a simple #ahah[progress] type string into an array.

View File

@ -43,6 +43,8 @@ Drupal.ahah = function(base, element_settings) {
this.effect = element_settings.effect; this.effect = element_settings.effect;
this.method = element_settings.method; this.method = element_settings.method;
this.progress = element_settings.progress; this.progress = element_settings.progress;
this.button = element_settings.button || { };
if (this.effect == 'none') { if (this.effect == 'none') {
this.showEffect = 'show'; this.showEffect = 'show';
this.hideEffect = 'hide'; this.hideEffect = 'hide';
@ -70,6 +72,7 @@ Drupal.ahah = function(base, element_settings) {
var ahah = this; var ahah = this;
var options = { var options = {
url: ahah.url, url: ahah.url,
data: ahah.button,
beforeSubmit: function(form_values, element_settings, options) { beforeSubmit: function(form_values, element_settings, options) {
return ahah.beforeSubmit(form_values, element_settings, options); return ahah.beforeSubmit(form_values, element_settings, options);
}, },

File diff suppressed because one or more lines are too long