[Haskell-cafe] Happstack, RqData: (How) can I extract multiple data from form?

Никитин Лев leon.v.nikitin at pravmail.ru
Mon Oct 18 12:14:02 EDT 2010



Hello.

(How) can I query multiple data from form?

Foor form ala

<form>
 <input name="foo"/>
 <input name="foo"/>
/form>
 
 I can use 'looks "foo"' to get array of values. Ok.

But Is there any way to extract values from such form:

<form>
 <input name="key" val="key1"/><input name="tag" val="tag11/><input name="tag" val="tag12/>...
 <input name="key" val="key2"/><input name="tag" val="tag21/><input name="tag" val="tag22/>...
/form>

to get something like [("key1", ["tag11", "tag12"]), ("key2", ["tag21", "tag22"]) ] ?

One of requirement is possibility to add additionally key and tags for this key (via button, using javascript).
Can I groupe such pairs using html?

Maybe I have to do like this:

<form>
 <input name="key" val="key1"/><input name="tag-key1" val="tag11/><input name="tag-key1" val="tag12/>
 <input name="key" val="key2"/><input name="tag-key2" val="tag21/><input name="tag-key2" val="tag22/>
/form>,

but i dont see any (simple) way to add dinamicly add other list of keyed tags in such manner (by user, o client side).






More information about the Haskell-Cafe mailing list