mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
reverting r52412, as it breaks not validating not send values, sending empty array for nothing selected in selectbox instead of (not submitted) null value
This commit is contained in:
parent
4ccc9b2cdb
commit
d82f65e95e
@ -520,7 +520,7 @@ class etemplate_new extends etemplate_widget_template
|
||||
{
|
||||
if (!is_array($v) || !isset($old[$k]) || // no array or a new array
|
||||
isset($v[0]) && !is_array($v[0]) && isset($v[count($v)-1]) || // or no associative array, eg. selecting multiple accounts
|
||||
is_array($v) && count($v) == 0 && is_array($old[$k])) // Empty array replacing non-empty
|
||||
is_array($v) && count($v) == 0) // Empty array replacing non-empty
|
||||
{
|
||||
$old[$k] = $v;
|
||||
}
|
||||
|
@ -213,10 +213,12 @@ class etemplate_widget_menupopup extends etemplate_widget
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($value))
|
||||
{
|
||||
self::set_array($validated, $form_name, $value);
|
||||
//error_log(__METHOD__."() $form_name: ".array2string($value_in).' --> '.array2string($value).', allowed='.array2string($allowed));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//error_log($this . "($form_name) is read-only, skipping validate");
|
||||
|
@ -2394,7 +2394,7 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
|
||||
}
|
||||
|
||||
// Legacy: Add in 'All' option for cat_id, if not provided.
|
||||
if(name == 'cat_id' && options != null && (typeof options[''] == 'undefined' || options[0].value != ''))
|
||||
if(name == 'cat_id' && options != null && (typeof options[''] == 'undefined' || typeof options[0] != 'undefined' && options[0].value != ''))
|
||||
{
|
||||
widget_options.empty_label = this.egw().lang('All');
|
||||
}
|
||||
|
@ -725,11 +725,12 @@ var et2_selectbox = et2_inputWidget.extend(
|
||||
var value = [];
|
||||
jQuery("input:checked",this.multiOptions).each(function(){value.push(this.value);});
|
||||
// we need to return null for no value instead of empty array, which gets overwritten by preserved value on server-side
|
||||
this.value = value.length > 0 ? value : null;
|
||||
this.value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.value = this._super.apply(this, arguments);
|
||||
if (this.value === null) this.value = []; // do NOT return null, as it does not get transmitted to server
|
||||
}
|
||||
return this.value;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user