You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
During the OSMC Hackathon @lippserd and I discovered a bug in the Icingaweb2 core. We modified the ScheduleServiceDowntimeCommandForm.php file and added 'preserveDefault' => true to a dateTimePicker object:
array(
'dateTimePicker',
'end',
array(
'required' => true,
'preserveDefault' => true,
'label' => $this->translate('End Time'),
'description' => $this->translate('Set the end date and time for the downtime.'),
'value' => $end
)
),
According to @lippserd this should work with a dateTimePicker object without an issue. Instead we got an error:
Warning: Exception caught by form: htmlspecialchars() expects parameter 1 to be string, object given Stack Trace: #0 [internal function]:
Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(2, 'htmlspecialchar...', '/vagrant/librar...', 94, Array)
#1 /vagrant/library/vendor/Zend/Form/Decorator/HtmlTag.php(94): htmlspecialchars(Object(DateTime), 2, 'UTF-8') #2 /vagrant/library/vendor/Zend/Form/Decorator/HtmlTag.php(162): Zend_Form_Decorator_HtmlTag->_htmlAttribs(Array)
#3 /vagrant/library/vendor/Zend/Form/Decorator/HtmlTag.php(223): Zend_Form_Decorator_HtmlTag->_getOpenTag('input', Array)
#4 /vagrant/library/vendor/Zend/Form/Element.php(2048): Zend_Form_Decorator_HtmlTag->render('<div class="con...')
#5 /vagrant/library/vendor/Zend/Form/Decorator/FormElements.php(115): Zend_Form_Element->render()
#6 /vagrant/library/vendor/Zend/Form/DisplayGroup.php(914): Zend_Form_Decorator_FormElements->render('')
#7 /vagrant/library/vendor/Zend/Form/Decorator/FormElements.php(115): Zend_Form_DisplayGroup->render() in /vagrant/library/vendor/Zend/Form.php on line 2995
As a workaround we modified the value assertion:
'value' => $end->format('Y-m-d\TH:i:s')
We worked on the current master and wanted to add functionality to the downtime form.
The text was updated successfully, but these errors were encountered:
ekeih
changed the title
'preserveDefault' => true in forms does not work for dateTimePicker objects
preserveDefault in forms does not work for dateTimePicker objects
Nov 8, 2018
During the OSMC Hackathon @lippserd and I discovered a bug in the Icingaweb2 core. We modified the
ScheduleServiceDowntimeCommandForm.php
file and added'preserveDefault' => true
to adateTimePicker
object:According to @lippserd this should work with a dateTimePicker object without an issue. Instead we got an error:
As a workaround we modified the value assertion:
We worked on the current master and wanted to add functionality to the downtime form.
The text was updated successfully, but these errors were encountered: