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

Input elements "name" attribute should allow arbitrary strings instead of only ID #40

Open
jhorstmann opened this issue Jun 13, 2023 · 3 comments · May be fixed by #41
Open

Input elements "name" attribute should allow arbitrary strings instead of only ID #40

jhorstmann opened this issue Jun 13, 2023 · 3 comments · May be fixed by #41

Comments

@jhorstmann
Copy link

It's been a long time since I did any html, but I remember being able to use names such as foo[0].bar or foo[] as input field names, so that a web framework could reconstruct a nested structure from query/form parameters. It seems this is not currently supported, and the attribute is defined as being of type ID.

Using such a name leads to a runtime panic such as

ERROR: <input name="foobar[]"> failed to parse attribute value: ID can only contain alphanumerics, dash, dot and underscore

The whatwg html spec does not seem to restrict the contents of the name attribute:

Other than isindex, any non-empty value for name is allowed

@shadows-withal
Copy link

This is true, yeah. You'd especially use this in the context of complex web forms that are generated either server-side or by some client-side framework (especially the former is important for axohtml's usage). I think we can relax these restrictions.

@jhorstmann
Copy link
Author

Thank you for the quick reaction! I'd be happy to provide a PR if you are interested.

@shadows-withal shadows-withal pinned this issue Jun 14, 2023
@shadows-withal shadows-withal unpinned this issue Jun 14, 2023
@shadows-withal
Copy link

Sure, if you're up for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants