Fixes disabled relation nulling value

Just like DatePicker, relation and even regular fields should omitted from the data set
The same logic should apply to hidden fields
Fixes #1827
Recompile assets
This commit is contained in:
Samuel Georges 2016-05-15 06:47:28 +10:00
parent eaea0fc541
commit cb86e655dd
4 changed files with 14 additions and 2 deletions

View File

@ -125,7 +125,7 @@ class DatePicker extends FormWidgetBase
*/
public function getSaveValue($value)
{
if ($this->formField->disabled) {
if ($this->formField->disabled || $this->formField->hidden) {
return FormField::NO_SAVE_DATA;
}

View File

@ -2,6 +2,7 @@
use Db;
use Lang;
use Backend\Classes\FormField;
use Backend\Classes\FormWidgetBase;
use ApplicationException;
use SystemException;
@ -153,6 +154,10 @@ class Relation extends FormWidgetBase
*/
public function getSaveValue($value)
{
if ($this->formField->disabled || $this->formField->hidden) {
return FormField::NO_SAVE_DATA;
}
if (is_string($value) && !strlen($value)) {
return null;
}

View File

@ -960,6 +960,13 @@ class Form extends WidgetBase
* Spin over each field and extract the postback value
*/
foreach ($this->allFields as $field) {
/*
* Disabled and hidden should be omitted from data set
*/
if ($field->disabled || $field->hidden) {
continue;
}
/*
* Handle HTML array, eg: item[key][another]
*/

View File

@ -2825,8 +2825,8 @@ ul.autocomplete.dropdown-menu.inspector-autocomplete li a{padding:5px 12px;white
@media (min-width:992px){.modal-lg{width:900px}
}
.modal-content{-webkit-box-shadow:none;box-shadow:none;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;border:none;background:#f9f9f9}
.modal-content .close{color:#fff}
.modal-header{background:#bf5d07;color:#ecf0f1;text-shadow:0 -1px 0 rgba(0,0,0,0.6);-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,0.1);box-shadow:inset 0 -2px 0 rgba(0,0,0,0.1);border-top-right-radius:5px;border-top-left-radius:5px;border:none}
.modal-header .close{color:#fff}
.modal-header h4{font-weight:600;font-size:16px}
.modal-footer{background:transparent;border:none;margin-top:0;padding:0 20px 20px 20px}
.modal-body{padding-bottom:0}