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

Remove hard coded HTML ids from UserFields.Edit.cshtml view #12531

Closed
MikeAlhayek opened this issue Oct 1, 2022 · 3 comments · Fixed by #12532
Closed

Remove hard coded HTML ids from UserFields.Edit.cshtml view #12531

MikeAlhayek opened this issue Oct 1, 2022 · 3 comments · Fixed by #12532
Milestone

Comments

@MikeAlhayek
Copy link
Member

MikeAlhayek commented Oct 1, 2022

Is your feature request related to a problem? Please describe.

I am trying to create a feature that would allow an Admin to bulk import users from excel file. After the user uploaded the excel file, I want to build the Edit fields for every user in my file. This means calling the UserFields.Edit.cshtml multiple times in the same output. The only problem that I am facing is that the password generator fails because the same html id are used on the same page which is not good. Here are the hard coded ids generatePassword, passwordConfirmationToggle, passwordToggle and copyPassword.

Describe the solution you'd like

We should never hard code fixed ID in views that are used by driver. Instead, we should dynamically generate ID or class name to allow the user to reuse the views if needed like in my case.

Workaround

I override the view in my own theme, but since this view is driver driven, I think it should be robust.

MikeAlhayek added a commit to MikeAlhayek/OrchardCore that referenced this issue Oct 1, 2022
@MikeAlhayek MikeAlhayek changed the title Replace hardcoded HTML ids with generated ID to allow the reuse of UserFields.Edit.cshtml Replace hard coded HTML ids with generated ID Oct 1, 2022
@hishamco
Copy link
Member

hishamco commented Oct 1, 2022

The only problem that I am facing is that the password generator fails because the same html id are used on the same page which is not good.

Could you please point where the password generaor id used more than once?

@MikeAlhayek
Copy link
Member Author

As mentioned I am working a module that allows my admin to import multiple users, and when I call the build editor on the User display manager, the listed ids appear more than once.

@hishamco
Copy link
Member

hishamco commented Oct 1, 2022

This is happen according to your scenario, but I didn't see any issue in the current view

@MikeAlhayek MikeAlhayek changed the title Replace hard coded HTML ids with generated ID Remove hard coded HTML ids from UserFields.Edit.cshtml view Oct 3, 2022
@sebastienros sebastienros added this to the 1.x milestone Oct 6, 2022
@Skrypt Skrypt modified the milestones: 1.x, 1.5 Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants