datagrid icon indicating copy to clipboard operation
datagrid copied to clipboard

HTMLs for range filters don't conform to the HTML standards

Open masasakano opened this issue 9 months ago • 4 comments

The range filter produced by Datagrid generates a HTML that violates the HTML-5 standards:

Attribute multiple not allowed on element input with type="text"

(See HTML5 standards about input for detail of the specification.)

The form in the HTML for a range filter of Datagrid tries to pass a (2-element) Array when submitted, and Rails does interpret them as an Array (and so the filter works). But the HTML standards basically do not allow such pair of fields of input with type=text.

It should be better if the generated HTML for a range filter conforms to the HTML standard.

I asked a question about it in Stackoverflow, and an answer suggests using forms of:

  • my_model[my_attribute][from]
  • my_model[my_attribute][to]

as opposed to the current way of multiple

  • my_model[my_attribute][]

So, this may be a way to implement the (grammatically) correct pair of HTML-form fields for a range filter. Obviously, I suppose there are many other ways.

masasakano avatar May 29 '24 22:05 masasakano