?
avatar saimiri
saimiri
9 Apr 2017

I noticed a bug in the way the id attributes are created for repeatable subform fields in the JavaScript. On line 163 in subform-repeatable.js there is this:

id = name.replace(/(\]|\[\]$)/g, '').replace(/\[/g, '_')

which in the end produces id attributes like jform_contacts_contacts3_is_primary0. Unfortunately, the id attributes in the subform templates are in the format of jform_contacts__contactsX__is_primary, so the correct result should be something like jform_contacts__contacts3__is_primary0, with double underscores.

Because the id attribute doesn't match what is in the templates, the label elements get broken because their for attribute ends up being jform_contacts__contactsX__is_primary0 or similar, that is, the X does not get replaced.

A quick and dirty fix is to replace aforementioned line with

id = name.replace(/(\]\[)/g, '__').replace(/(\[)/g, '_').replace(/(\]$)/g, '')

but I'm sure there is a smarter way, too.

avatar saimiri saimiri - open - 9 Apr 2017
avatar joomla-cms-bot joomla-cms-bot - change - 9 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 9 Apr 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 9 Apr 2017
Category Fields JavaScript
avatar franz-wohlkoenig franz-wohlkoenig - change - 9 Apr 2017
Priority Medium Low
avatar Fedik
Fedik - comment - 28 May 2017

I can confirm the issue,
Additionally: <fieldset class="radio"> of radio buttons, also has "unfixed" id

avatar franz-wohlkoenig franz-wohlkoenig - change - 28 May 2017
Status New Confirmed
avatar Fedik
Fedik - comment - 3 Jun 2017

@saimiri please test #16480

avatar joomla-cms-bot joomla-cms-bot - change - 3 Jun 2017
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 3 Jun 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Jun 2017
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2017-06-03 15:39:34
Closed_By franz-wohlkoenig
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 3 Jun 2017

closed as having PR #16480


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15187.

avatar joomla-cms-bot
joomla-cms-bot - comment - 3 Jun 2017

Add a Comment

Login with GitHub to post a comment