The goal
How to make a Select input with Ocsigen
The solution
open Lwt open XHTML.M open Eliom_services open Eliom_parameters open Eliom_sessions open Eliom_predefmod.Xhtml open Mysql open Postgresql let coucou_handler _ selection () = Lwt.return (html (head (title (pcdata "Results")) []) (body [p [ pcdata ("You sent: " ^ selection)]])) let coucou_service = Eliom_predefmod.Xhtml.register_new_service ~path: ["coucou"] ~get_params: (Eliom_parameters.string "selection") coucou_handler let coucou_form enter_selection = [XHTML.M.fieldset [Eliom_predefmod.Xhtml.string_select ~name:enter_selection (Eliom_predefmod.Xhtml.Option ([], "one", Some (pcdata "um"), false)) [Eliom_predefmod.Xhtml.Option ([], "two", Some (pcdata "dois"), false); Eliom_predefmod.Xhtml.Option ([], "three", Some (pcdata "trĂªs"), true)]; Eliom_predefmod.Xhtml.string_input ~input_type:`Text ~value:"un email seulement" (); Eliom_predefmod.Xhtml.string_input ~input_type:`Submit ~value:"Send" ()]] let main_handler sp () () = let myform = Eliom_predefmod.Xhtml.get_form coucou_service sp coucou_form in Lwt.return (html (head (title (pcdata "")) []) (body [p [pcdata "Form for coucou:"]; myform])) let main_service = Eliom_predefmod.Xhtml.register_new_service ~path: [""] ~get_params: Eliom_parameters.unit main_handler