Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
How something so small can turn into a "heated argument" says more about both of you
-
h4xx3r17165yForm input as an array 🤔... Are taking about sending the form inputs as a JSON object?
-
Quirinus7535yCan I get a job there? I know txt, xml and csv! Im good at assembling legos, as well.
-
I'm confused why you'd want to. Isn't it usually done via constructing an object and sending that to the API? Am I missing something?
-
feroza9775y@M1sf3t @polaroidkidd e.g
<input name="product[name]">
<input name="product[price]">
On the back-end I would directly fill the entire product array into my Product model, since I have a name and price property. -
feroza9775y@sSam That is the name of the input, the two inputs would get POSTed to the back-end as an array with title and price items.
This is standard practice, nothing out of the usual. -
@feroza ah, I see. Thank you for clarifying.
Personally deconstructing a JSON object seems preferable for me. I could map it directly to a POJO or if my backend is on JS, so much the better (that is, if the form always sends the same elements)
Either way, I learnt something today!
Related Rants
Just started work at this new company as a backend developer and immediately got into a heated argument with one of the front end guys.
Poor guy has been a front end developer for 5 years and doesn't know how to submit a form input as an array.
FML
rant
front-end
back-end