-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Subform - Wrong ID generated for the elements of subform when we click on Plus (+) button to add repeated subform #25387 #25398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s as well as registered users
Fix for issue with ID joomla#22586 :- Show action logs for guest users as w…
…k on Plus (+) button to add repeated subform joomla#25387
| id = name.replace(/(\[\]$)/g, '').replace(/(\]\[)/g, '__').replace(/\[/g, '_').replace(/\]/g, ''), // id from name | ||
| nameNew = name.replace('[' + group + '][', '['+ groupnew +']['), // New name | ||
| idNew = id.replace(group, groupnew), // Count new id | ||
| idNew = id.replace(group, groupnew).replace(/[\W]+/g,"_"), // Count new id and replace non-word characters in name with underscore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify id instead of idNew so labels work properly. Also multiple characters should probably be replaced by multiple underscores.
E.g. in PHP Test (optional) field generates jform_com_fields__repeat__repeat0__Test__optional_. Now in JS it generates jform_com_fields__repeat__repeat0__Test_optional_.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have modified the id instead of idNew also now multiple non-word characters are replaced with underscores
…k on Plus (+) button to add repeated subform joomla#25387 joomla#25398
…k on Plus (+) button to add repeated subform joomla#25387 joomla#25398
| var $el = $(haveName[i]), | ||
| name = $el.attr('name'), | ||
| id = name.replace(/(\[\]$)/g, '').replace(/(\]\[)/g, '__').replace(/\[/g, '_').replace(/\]/g, ''), // id from name | ||
| id = name.replace(/(\[\]$)/g, '').replace(/(\]\[)/g, '__').replace(/\[/g, '_').replace(/\]/g, '').replace(/\W/g,"_"), // id from name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codestyle.
| id = name.replace(/(\[\]$)/g, '').replace(/(\]\[)/g, '__').replace(/\[/g, '_').replace(/\]/g, '').replace(/\W/g,"_"), // id from name | |
| id = name.replace(/(\[\]$)/g, '').replace(/(\]\[)/g, '__').replace(/\[/g, '_').replace(/\]/g, '').replace(/\W/g, '_'), // id from name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the Codestyle
|
@ankush-maherwal please test (how to: https://docs.joomla.org/Testing_Joomla!_patches) |
…k on Plus (+) button to add repeated subform joomla#25387 joomla#25398
|
Now you need to generate a minified file ( |
…k on Plus (+) button to add repeated subform joomla#25387 joomla#25398
|
updated the related minified js file |
|
@SharkyKZ what tools shall be used for minification? |
|
Is manually modified minified file fine in this case? |
|
as of now I have manually modified the minified JS |
|
@crystalenka @ankush-maherwal please test (how to: https://docs.joomla.org/Testing_Joomla!_patches) |
|
I have tested this item ✅ successfully on 9570c0d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25398. |
|
thx |
Pull Request for Issue #25387
Summary of Changes
The value of id attribute of input element is checked for non-word characters and if non-word characters are found then replacing with them with underscore
Testing Instructions
Check the value of id attribute of input element in repetable subform after clicking the plus (+) button to add new clone of sub-form
Expected result
The value of id attribute of input element should not contain any non-word character
Actual result
The non-word characters in the value of id attribute of input element are being replaced with underscore
Documentation Changes Required
no change required in documentation