fixed react forms (new bug discovered on new forms with default values not saved)

This commit is contained in:
Jonathan Labreuille
2016-05-18 16:06:31 +02:00
parent 0c8a8c6854
commit 046127eeba
17 changed files with 164 additions and 66 deletions

View File

@@ -109,6 +109,10 @@ class Date extends Base {
$month_names = static::getMonthNames();
$html = '';
// empty value label
$html .= '<option value="">'.__('Month').'</option>';
for($i = 1; $i < 13; $i++) {
$is_selected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '<option value="'.$i.'" '.$is_selected.'>';
@@ -125,6 +129,7 @@ class Date extends Base {
'from' => (int)strftime('%Y') - 100,
'to' => (int)strftime('%Y')
);
// is default today
if(!empty($block['params']['is_default_today'])) {
$defaults['selected'] = (int)strftime('%Y');
@@ -135,6 +140,9 @@ class Date extends Base {
$html = '';
// empty value label
$html .= '<option value="">'.__('Year').'</option>';
// return years as an array
for($i = (int)$block['to']; $i > (int)($block['from'] - 1); $i--) {
$is_selected = ($i === $block['selected']) ? 'selected="selected"' : '';
@@ -158,6 +166,9 @@ class Date extends Base {
$html = '';
// empty value label
$html .= '<option value="">'.__('Day').'</option>';
// return days as an array
for($i = 1; $i < 32; $i++) {
$is_selected = ($i === $block['selected']) ? 'selected="selected"' : '';