News for hackers. Stuff that matters.
Re:Browsers, JSON, and FormData by TheRealPomax on Saturday November 12, 2022 @11:41AM (#33574685)
Forms are for sending data to URLs, what would the use-case of a nested form even be?
Re:Browsers, JSON, and FormData by Timwi on Saturday November 12, 2022 @12:11PM (#33574944)
Can't speak for the OP, but more than once I've run into a case where I need the form tags to be nested in the DOM, for reasons relating to the page structure but not the form contents. I would like nested form elements to just be allowed in the DOM, and if you submit the inner form then the outer should just be ignored, and if you submit the outer it should just submit all of the form values.
Re:Browsers, JSON, and FormData by artificialLimbs on Saturday November 12, 2022 @12:31PM (#33575159)
Would this not be a(nother) good use case for htmx?
Re:Browsers, JSON, and FormData by TheRealPomax on Saturday November 12, 2022 @01:54PM (#33575877)
That sounds... confusing? What is the form supposed to do when you submit it if it has another form inside it but that form's values are... a separate form? Without a concrete use-case, I'm having a hard time understanding how this would make sense.
Re:Browsers, JSON, and FormData by rickstanley on Saturday November 12, 2022 @02:16PM (#33576091)
Today we have the form attribute [0] to alleviate some cases.

[0]: https://caniuse.com/form-attribute

Re:Browsers, JSON, and FormData by megaman821 on Saturday November 12, 2022 @12:58PM (#33575379)
Nested forms would be great if you could prefix the name attributes easily. Like filling out a form where it asks for your name and your spouse's name. Now the first name and last name keys are in the form twice.
Re:Browsers, JSON, and FormData by TheRealPomax on Saturday November 12, 2022 @01:52PM (#33575852)
Okay but that's a terrible example: lots of people don't have the same last name despite being married. So you better use separate fields for that if you want "last names". But of course, programmers famously have no idea what names are, resulting in a never ending stream of "why the fuck won't you let me use the name that I have?" for anything from ecommerce to government websites, so you really shouldn't even have a separate first and last name field, you should just have a "name" field, and it bloody well better support all of unicode, because the only person who can tell you what their name is, is the person filling out the field, not you as form designer =)

[1] https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-... [2] https://shinesolutions.com/2018/01/08/falsehoods-programmers...