Reputation: 2928
Is there any way for Pyramid to process HTML form input which looks like this:
<input type="text" name="someinput[]" value="" />
or even more usefully:
<input type="text" name="someinput[0][subelement1]" value="" />
<input type="text" name="someinput[0][subelement2]" value="" />
<input type="text" name="someinput[1][subelement1]" value="" />
<input type="text" name="someinput[1][subelement2]" value="" />
...and access that data easily (e.g. via a dict)?
Any help would be much appreciated!
EDIT: to make it clearer, what I need is the ability to have a form where a user can add as many 'instances' of a group of input elements, e.g. adding between 1 and n users, each containing a firstname
, lastname
, username
(or something like that).
Upvotes: 4
Views: 1508
Reputation: 2479
One solution would be to use peppercorn. Although it does not support the syntax you're looking for, it will let you send structured data to your Pyramid application through the use of forms. A more casual description exists too.
Upvotes: 3