That doesn't seem so hard, and I could imagine a couple different ways to do this with minimum back-and-forth for non-javascript users -- and no real need for javascript at all, really.

One way: a specific form/submit button is used to add a question, and there's a type-in to accept the number of possible answers to make available (either including the right answer, or in addition to it), and this defaults to some reasonable value. On submitting this, a second form is given with type-ins for the question itself, and for the requested number of answers.

Another way: when responding to a request to add a question (no other parameter needed), simply provide three text entry boxes: one for the question, one for the right answer, and a larger (scrollable) one for a list of wrong answers, with instructions on how to mark the boundaries between distinct wrong answers in this box (e.g. use "===" or something like that). So long as you provide a "preview" stage (like PM does), this should work fine.

In either case, all the components for a new question are submitted at one time; you just need to name and maintain the user/quiz-id and the question-id within the quiz, and based on those, it's simple enough to identify make up identifiers for the "correct answer" string and each of the "wrong answer" strings.


In reply to Re^3: Organizing Form Input by graff
in thread Organizing Form Input by Spidy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.