2016-10-10, 02:24:40
FieldDatepicker bug
Hi,
after clean install I've tried to assign two datepicker fields. Calendars stop working. After quick inspection I've found out that datepickers haven't unique ids. So I've replaced code as:
fields\FieldDatepicker.php
Old:
New:
Now I can have as much datepickers I want.
Best regards, T
Hi,
after clean install I've tried to assign two datepicker fields. Calendars stop working. After quick inspection I've found out that datepickers haven't unique ids. So I've replaced code as:
fields\FieldDatepicker.php
Old:
Code:
$output = $this->tpl->render($textfield, array(
'name' => $this->name,
'class' => $this->class,
'style' => !empty($this->style) ? ' style="'.$this->style.'" ' : '',
'id' => 'datepicker',
'value' => $value), true, array()
);
$output .= '
<script>
$(function() {
$( "#datepicker" ).datepicker({
dateFormat: "'. $format .'"
});
});
</script>';
Code:
$output = $this->tpl->render($textfield, array(
'name' => $this->name,
'class' => $this->class,
'style' => !empty($this->style) ? ' style="'.$this->style.'" ' : '',
'id' => $this->id,
'value' => $value), true, array()
);
$output .= '
<script>
$(function() {
$( "#'.$this->id.'" ).datepicker({
dateFormat: "'. $format .'"
});
});
</script>';
Now I can have as much datepickers I want.
Best regards, T