18
feroza
5y

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

Comments
  • 8
    How something so small can turn into a "heated argument" says more about both of you
  • 3
    Form input as an array 🤔... Are taking about sending the form inputs as a JSON object?
  • 4
    Can I get a job there? I know txt, xml and csv! Im good at assembling legos, as well.
  • 1
    @h4xx3r Nope, we're talking about grouping form inputs into an array 😆
  • 1
    @feroza visually or programmatically? 🤔
  • 0
    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?
  • 0
    @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.
  • 0
    @feroza that html doesn't make sense? Why your input name would have the value of product name? Also I think calling custom key array just array is confusing.
  • 0
    @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.
  • 0
    @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!
Add Comment