Gunnar Bittersmann: Inklusives Formular

Beitrag lesen

@@1unitedpower

Schöner Artikel, ich hab eine Idee für einen Folge-Artikel: In der Praxis sind die nativen Möglichkeiten zur Validierung schnell erschöpft. Zum Beispiel kann man nicht ohne JavaScript ausdrücken, dass in einer Gruppe von Radioboxen eine Auswahl verpflichtend ist

In der Praxis liegt dem Ruf nach JavaScript desöfteren die Unkenntnis der Möglichkeiten von HTML und CSS zugrunde. Zum Beispiel kann man das doch. Guckst du.

Look Ma, no JavaScript!

Die HTML-Spec sagt: “For radio buttons, the required attribute is satisfied if any of the radio buttons in the group is selected. Thus […] any of the radio buttons can be checked, not just the one marked as required.”

Verwirrt? Nun, da führt die Spec weiter aus: “To avoid confusion as to whether a radio button group is required or not, authors are encouraged to specify the attribute on all the radio buttons in a group.”

LLAP 🖖

--
“I love to go to JS conferences to speak about how to avoid using JavaScript. Please learn CSS & HTML to reduce your JS code bloat.” —Estelle Weyl