36 ms·
I think the good old form.elements is superior for getting values instead of querySelectorAll, but a lot of people have never even heard of this api. It‘s great
by config_yml 4y ago
I think the good old form.elements is superior for getting values instead of querySelectorAll, but a lot of people have never even heard of this api. It‘s great if you‘re dealing with forms.
I‘m not sure why the author doesn‘t want to handle form/multipart. Does Go not have good ergonomics for this case?
- duncans 4y agoAlso the author's approach doesn't take into account dealing with multi-value form elements such as `<select multiple>` or multiple `<input type=checkbox>` with the same name which is all handled by standard HTML forms POST encoding.
- eatonphil 4y agoWhen you're writing your own code for your own apps you're allowed to make your own assumptions. :)
- deleted 4y ago[deleted]
- eatonphil 4y agoThanks! It had been a while since I've written vanilla JS form code so I forgot about both FormData and form.elements.
- wildrhythms 4y agoFormData rules! https://developer.mozilla.org/en-US/docs/Web/API/FormData https://developer.mozilla.org/en-US/docs/Web/API/FormData