4

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).

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

This seems to be close enough to what I'm looking for, thanks! I do wish there was a 'better' (or more elegant) way of doing it, though.
If you hear of one, let me know. In the meantime, heap scorn upon the original developers of HTML forms, whom I'm pretty sure ate soup with their hands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.