I use the following code to invoke the calendar function:
JHtml::_('calendar', $struntil, "jform[freq_until]","jform_freq_until", $this->getFormat(), array("onchange" => "buildRule();")) which worked fine in a prior version of Joomla (I think 3.6).
Html to be rendered with the attribute 'onchange = "buildRule();'.
Html renders correctly except that the 'onchange' attribute is missing.
Joomla 3.8.6
I tried entering other attributes to see if they would render but none of them would.
Labels |
Added:
?
|
Category | ⇒ | JavaScript |
Labels |
Added:
J3 Issue
|
It doesn't appear to be. The problem I am seeing applies to the calendar method not rendering any specified attributes. The particular 'onchange' I am trying to use is a specific example. I tested other attributes and none work. The data input is ignored.
Status | New | ⇒ | Discussion |
Please try changing onchange
to onChange
in your code.
For JHtml helper 'calendar' method all (the new) multiple word attributes names added with the J3.7.0 new calendar are camelcase
https://github.com/joomla/joomla-cms/blob/staging/libraries/src/HTML/HTMLHelper.php#L1031-L1041
and the attribute names are not documented ?
https://docs.joomla.org/API17:JHtml::calendar
https://docs.joomla.org/JHTML/calendar
But when using the same attributes in an XML file ('calendar' form field element type)
they are lowercase which is confusing as you need to remember that --some-- attributes need to be camelcase when using JHtml instead of XML file
https://docs.joomla.org/Calendar_form_field_type
And then the layout file expects some these names to be camel case and some of the names are not only lowercase but also different name, so if you try to load the layout in custom code then you need to even account for different names ...
Just especially for onchange JHtml helper 'calendar' method
(which existed before J3.7.0 new calendar)
https://github.com/joomla/joomla-cms/blob/staging/libraries/src/HTML/HTMLHelper.php#L1039
Maybe patch the JHtml helper 'calendar' method to check for both camelcase and lowercase ?
Capitalizing the C fixes the issue.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-03-31 10:12:43 |
Closed_By | ⇒ | willcycle |
Is this the same as #17515