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

including the same form multiple times creates duplicate CSS-IDs #957

Closed
fritzmg opened this issue Jul 12, 2017 · 7 comments
Closed

including the same form multiple times creates duplicate CSS-IDs #957

fritzmg opened this issue Jul 12, 2017 · 7 comments

Comments

@fritzmg
Copy link
Contributor

fritzmg commented Jul 12, 2017

If you include the same form multiple times on a page, each form will get the same CSS-ID, e.g. id="f1".

Though I wonder now, is inserting the same form multiple times on the same page (i.e. once in the header and once in the footer) not a supported use case?

@ausi
Copy link
Member

ausi commented Jul 12, 2017

I think this is related to contao/core#8538 (comment)

@fritzmg
Copy link
Contributor Author

fritzmg commented Jul 12, 2017

Hm, yes I thought so too, I wasn't sure though since the original issues was about the page cache.

@leofeyer leofeyer added the bug label Jul 12, 2017
@leofeyer leofeyer added this to the 4.4.2 milestone Jul 12, 2017
@leofeyer
Copy link
Member

Fixed in bd3c749.

@fritzmg
Copy link
Contributor Author

fritzmg commented Sep 29, 2017

This is not fixed completely. Including the same form multiple times on a page will still cause duplicate CSS-IDs. While it is fixed for the CSS-ID of the <form> itself, it still happens for each individual form element, eg.

<input name="email" id="ctrl_1" class="text mandatory" value="" placeholder="Email …" required="" type="email"><input name="email" id="ctrl_1" class="text mandatory" value="" placeholder="Email …" required="" type="email">

@leofeyer leofeyer modified the milestones: 4.4.2, 4.4.7 Oct 4, 2017
@leofeyer leofeyer reopened this Oct 4, 2017
@leofeyer
Copy link
Member

leofeyer commented Oct 10, 2017

@contao/developers I think changing the form field IDs is a BC break, isn't it? The ID could be used in a CSS or JS selector. Then again we have removed the default form ID … 😄

@fritzmg
Copy link
Contributor Author

fritzmg commented Oct 10, 2017

Indeed. I know of at least one extension that relies on the form field CSS IDs.

Could it be done for Contao 4.5?

@leofeyer leofeyer removed this from the 4.4.7 milestone Oct 10, 2017
@Toflar
Copy link
Member

Toflar commented Nov 2, 2017

I guess it's just a known limitation that you cannot use the very same form on the same page. The ctrl_<n> is only one problem but you would generate two identical FORM_SUBMIT values so the first one would actually respond to the form submit of the second one. Even if there were errors, the first one would show them instead of the second one. It's not really worth fixing if you ask me.

@leofeyer leofeyer closed this as completed Nov 7, 2017
leofeyer added a commit that referenced this issue Nov 12, 2019
Description
-----------

This will make the coverage check results appear more quickly. Also, it is another step towards moving from Travis to GitHub actions.

Commits
-------

75d0c42a Add a GitHub action to create the coverage reports
fa8586cd Run the CS fixer
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

4 participants