Re: ocamlnet; form + checkboxes (multiple checked)

Gerd Stolpmann <[email protected]> Tue, 17 May 2005 16:17:57 +0200
Newsgroups gmane.comp.lang.ocaml.lib.net.devel,gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Am Sonntag, den 15.05.2005, 22:57 +0200 schrieb Rakotomandimby (R12y)
Mihamina:
> Hello,
> 
> I'm trying to deal with ocamlnet.
> I would like to know what's the type of "argument_value"
> if multiple checkboxesa re checked.
> 
> For example, if I have a page like that:
> 
> <input type="checkbox" name"cb" value="a">a 
> <input type="checkbox" name"cb" value="b">b
> <input type="checkbox" name"cb" value="c">c
> 
> I will have:
> http://[...]/[...]?cb=a&cb=b&cb=c
> 
> If the checkboxes are alll checked.
> 
> Then I fi want to get it I have to do :
> 
> (*... cgi:cgi_activation ...*)
>   let x = cgi # argument_value "cb" ;
> (*...*)
> 
> Will it be a string list? a string array? a record?...

No, it is always the same type, i.e. a simple string. Using
argument_value you only get the value for the first checkbox.

If you need a string list, just do

let x = List.map (fun arg -> arg#value) (cgi # multiple_argument "cb")

> I'm so sorry if it is a dumb question, I'm just new to Ocaml, and I did
> search. But I cannot decrypt real source code yet, I'm so sorry.
> 
> PS: I'm sorry for crossposting to the author, because I did not find any
> Mailing list specific to ocamlnet. If gerd give me any answer that could
> solve my problem, I will forward it to the list. I will even write a
> tutorial... I began here for basical things in French (English is
> coming) : http://www.etud-orleans.fr/

I can include the link to the tutorial in the Ocamlnet web pages when it
is finished. Please drop a notice then.

Mailing list for Ocamlnet:

http://sourceforge.net/mail/?group_id=19774

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
[email protected]          http://www.gerd-stolpmann.de
------------------------------------------------------------




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click