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.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I noticed a bug in the way the
id
attributes are created for repeatable subform fields in the JavaScript. On line 163 insubform-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 ofjform_contacts__contactsX__is_primary
, so the correct result should be something likejform_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 theirfor
attribute ends up beingjform_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.
The text was updated successfully, but these errors were encountered: