Skip to content

Commit

Permalink
fix: default value of integer and float fields
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Feb 6, 2019
1 parent 93a7f84 commit 3d90e6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion inc/fields/floatfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ public function prepareQuestionInputForSave($input) {
}

if (isset($input['default_values'])) {
$this->value = (float) str_replace(',', '.', $input['default_values']);
if ($input['default_values'] != '') {
$this->value = (float) str_replace(',', '.', $input['default_values']);
} else {
$this->value = '';
}
}
$input['values'] = '';

Expand Down
6 changes: 5 additions & 1 deletion inc/fields/integerfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ public function prepareQuestionInputForSave($input) {
}

if (isset($input['default_values'])) {
$this->value = (int) $input['default_values'];
if ($input['default_values'] != '') {
$this->value = (int) $input['default_values'];
} else {
$this->value = '';
}
}
$input['values'] = '';

Expand Down

0 comments on commit 3d90e6b

Please sign in to comment.