J3 Issue ?
avatar willcycle
willcycle
28 Mar 2018

Steps to reproduce the issue

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).

Expected result

Html to be rendered with the attribute 'onchange = "buildRule();'.

Actual result

Html renders correctly except that the 'onchange' attribute is missing.

System information (as much as possible)

Joomla 3.8.6

Additional comments

I tried entering other attributes to see if they would render but none of them would.

avatar willcycle willcycle - open - 28 Mar 2018
avatar joomla-cms-bot joomla-cms-bot - change - 28 Mar 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Mar 2018
avatar willcycle willcycle - change - 28 Mar 2018
The description was changed
avatar willcycle willcycle - edited - 28 Mar 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2018
Category JavaScript
avatar brianteeman brianteeman - change - 30 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 30 Mar 2018
avatar brianteeman
brianteeman - comment - 30 Mar 2018

Is this the same as #17515

avatar willcycle
willcycle - comment - 30 Mar 2018

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.

avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Mar 2018
Status New Discussion
avatar Quy
Quy - comment - 30 Mar 2018

Please try changing onchange to onChange in your code.

avatar ggppdk
ggppdk - comment - 31 Mar 2018

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)

  • the attribute name before J3.7.0 was all lowercase ??
  • the attribute name with J3.7.0+ it became camelcase ??

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 ?

avatar willcycle
willcycle - comment - 31 Mar 2018

Capitalizing the C fixes the issue.

avatar willcycle willcycle - change - 31 Mar 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-03-31 10:12:43
Closed_By willcycle
avatar willcycle willcycle - close - 31 Mar 2018

Add a Comment

Login with GitHub to post a comment