Skip to content
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

Subform - Wrong ID generated for the elements of subform when we click on Plus (+) button to add repeated subform #25387

Closed
ankush-maherwal opened this issue Jul 1, 2019 · 4 comments

Comments

@ankush-maherwal
Copy link

Steps to reproduce the issue

  1. Add a subform field (repeatable) in any form and set the value of "min" attribute of subform field as 1
  2. Name one of the input field in the subform as (repetable_subform-test). i.e use hyphen in the name of the input field.
  3. For the first i.e the default block of repeatable subform the id of the input field with a hyphen in the name will be generated as "jform_com_tjucm_sample_subform__com_tjucm_sample_subform0__repetable_subform_test" as Joomla replaces all the non-word characters with (_) underscore for the attribute Id of all the fields (as per getId function in FormField class)
  4. After clicking on the plus (+) button to add the repeatable block the id of the field with a hyphen in the name the id is generated as "jform_com_tjucm_sample_subform__com_tjucm_sample_subform1__repetable_subform-test" i.e the id contains hyphen as the hyphen is not replaced with an underscore in the code of subform-repetable.js file

Expected result

The id of the field in subform was expected to be without any hyphen in it "jform_com_tjucm_sample_subform__com_tjucm_sample_subform1__repetable_subform_test"

Actual result

The id of the input element contains hyphen if the field name contains a hyphen
"jform_com_tjucm_sample_subform__com_tjucm_sample_subform1__repetable_subform-test"

System information (as much as possible)

Latest Joomla

Additional comments

getId() function in class FormField has the code which replaces all the non-word characters in the id of an element to underscore.

Such code is missing in the "subform-repeatable.js" which generated the clone of the fields in the subform

@ghost ghost added the J3 Issue label Jul 1, 2019
@ghost ghost changed the title [3.9] Subform - Wrong ID generated for the elements of subform when we click on Plus (+) button to add repeated subform Subform - Wrong ID generated for the elements of subform when we click on Plus (+) button to add repeated subform Jul 1, 2019
@ReLater
Copy link
Contributor

ReLater commented Jul 1, 2019

Just a question: Does this behavior lead to any issues/errors/malfunctions?

@ankushmaherwal
Copy link
Contributor

No, this behavior does not leads to any issue or error in Joomla core but the behavior is not gerneric in both the cases i.e Standard form and the sub-form which leads to difficulties for the extension developer to predict the behavior and impliment the solutions of thair problems.

@joomla-cms-bot
Copy link

Set to "closed" on behalf of @alikon by The JTracker Application at issues.joomla.org/joomla-cms/25387

@alikon
Copy link
Contributor

alikon commented Jul 2, 2019

please test #25398


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

ankushmaherwal pushed a commit to ankushmaherwal/joomla-cms that referenced this issue Jul 2, 2019
ankushmaherwal pushed a commit to ankushmaherwal/joomla-cms that referenced this issue Jul 2, 2019
ankushmaherwal pushed a commit to ankushmaherwal/joomla-cms that referenced this issue Jul 2, 2019
ankushmaherwal pushed a commit to ankushmaherwal/joomla-cms that referenced this issue Jul 2, 2019
HLeithner pushed a commit that referenced this issue Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants