widgets should NEVER return null (eg. for empty), as server-side $preserv will overwrite it

This commit is contained in:
Ralf Becker 2014-06-11 09:14:43 +00:00
parent 5d3d61e5b0
commit 5a32a7d622
2 changed files with 4 additions and 8 deletions

View File

@ -46,8 +46,8 @@ class etemplate_widget_date extends etemplate_widget_transformer
* @var string|array
*/
protected $legacy_options = 'dataformat,mode';
/**
* Validate input
*
@ -70,13 +70,9 @@ class etemplate_widget_date extends etemplate_widget_transformer
{
self::set_validation_error($form_name,lang('Field must not be empty !!!'));
}
elseif (is_null($value))
{
$valid = null;
}
elseif ($this->type == 'date-duration')
{
$valid = $value;
$valid = (string)$value === '' ? '' : (int)$value;
}
elseif (empty($this->attrs['dataformat'])) // integer timestamp
{

View File

@ -475,7 +475,7 @@ var et2_date_duration = et2_date.extend(
var value = this.duration.val().replace(',', '.');
if(value === '')
{
return this.options.empty_not_0 ? null : 0;
return this.options.empty_not_0 ? '' : 0;
}
// Put value into minutes for further processing
switch(this.format ? this.format.val() : this.options.display_format)