It’s also a Ruby thing. Python handles multiple inputs with the same name a bit better.
Well, this is timely! Just today I was having a really good natter with Charlotte about using checkboxes, specifically sending multiple values to the server:
You’ll notice that the
namegiven to each of these checkbox
inputelements is the same: “reservation-requested-device”. The square brackets (“”) at the end of the
nameare the magic bit that allows the values of each chosen “reservation-requested-device” checkbox to be submitted as the value of “reservation-requested-device”.
See, I wasn’t sure whether that was just a PHP thing (the only server-side input-handling I’ve had much experience of) or whether it was a more general way of sending multiple values.
Update: It seems that the square brackets are indeed a PHP thing. Multiple values will be sent in any case. See this test case.
For a python example, I can make a form like this: http://www.headsuptutoring.com/grid?pagetitle=%27oo%27+sound&top=s&top=p&top=oo&top=n&top=oo&top=ue&top=ew&letr=p&letr=r&letr=u&letr=n&letr=e&letr=&letr=&letr=s&letr=ou&letr=p&letr=r&letr=oo&letr=m&letr=&letr=b&letr=oo&letr=t&letr=n&letr=ew&letr=t&letr=oo&letr=b&letr=l&letr=ue&letr=g&letr=l&letr=ue&letr=&letr=s&letr=oo&letr=n&letr=m&letr=oo&letr=n&letr=&letr=t&letr=r&letr=ue&letr=g&letr=r&letr=ew&letr=&letr=t&letr=u&letr=n&letr=e&letr=f&letr=l&letr=ew&letr=u&letr=&letr=e&letr=&letr=&letr=th&letr=r&letr=ough&letr=&letr=&letr=&letr=&letr= and the backend handler just loops over the array