Malcolm Tredinnick wrote: > On Sun, 2007-06-10 at 18:10 -0700, David Priest wrote: > >> request.POST returns a QueryDict object for those fields that have >> the same key. The key appears to be assigned by Django when it >> magics the form and template into an http response. >> >> It seems difficult to get Django to deal with multiple lines on a >> form, ie. as when creating almost any business form where there's a >> single header (names, addresses) and many lines (SKUs, descriptions, >> costs, quantities, etc). >> >> One of the easier ways of dealing with this is to simply use two >> forms, one for the header and one for the line item, and then to >> repeat the line item a number of times over. Unfortunately, Django >> doesn't provide an easy way to differentiate between these lines; the >> field ids will all be the same. Munging the field names doesn't >> work; that just makes it impossible to refer to them on the template >> (variable names aren't dynamic). >> >> So we seem to be stuck getting lists back. Question is, *is the >> order of the list guaranteed*? Which is to say that will the first >> items in SKU, Description, and Cost all refer to the same object; the >> second items to the second object; and so on? >> > > The guarantee is that the items' order as the value for each key will > exactly match the order they were submitted by the form. I'm pretty sure > that means the answer to your question is "yes", but I can't immediately > find the right paragraph in the HTML spec that says that. > It is here
http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 For application/x-www-form-urlencoded: """The control names/values are listed in the order they appear in the document. The name is separated from the value by `=' and name/value pairs are separated from each other by `&'.""" For multipart/form-data: """A "multipart/form-data" message contains a series of parts, each representing a successful control. The parts are sent to the processing agent in the same order the corresponding controls appear in the document stream.""" /Nis --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---