Fixes the datepicker saving an empty value when disabled

Refs https://github.com/responsiv/campaign-plugin/issues/4
This commit is contained in:
Samuel Georges 2015-12-09 08:19:53 +11:00
parent 00be75ce13
commit a186a60c43
2 changed files with 7 additions and 1 deletions

View File

@ -97,7 +97,8 @@ abstract class FormWidgetBase extends WidgetBase
}
/**
* Process the postback value for this widget.
* Process the postback value for this widget. If the value is omitted from
* postback data, it will be NULL, otherwise it will be an empty string.
* @param $value The existing value for this widget.
* @return string The new value for this widget.
*/

View File

@ -1,6 +1,7 @@
<?php namespace Backend\FormWidgets;
use Carbon\Carbon;
use Backend\Classes\FormField;
use Backend\Classes\FormWidgetBase;
/**
@ -139,6 +140,10 @@ class DatePicker extends FormWidgetBase
*/
public function getSaveValue($value)
{
if ($this->formField->disabled) {
return FormField::NO_SAVE_DATA;
}
if (!strlen($value)) {
return null;
}