axodotdev / axodotdev/axohtml

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

Open
#40 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
119
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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`](https://github.com/axodotdev/axohtml/blob/main/typed-html/src/elements.rs#L233).

Using such a name leads to a runtime panic such as

```
ERROR: failed to parse attribute value: ID can only contain alphanumerics, dash, dot and underscore
```

The [whatwg html spec](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name) does not seem to restrict the contents of the `name` attribute:

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.