Module F.Form
type 'a param = 'a form_paramval float : float paramval int : int paramval int32 : int32 paramval int64 : int64 paramval nativeint : nativeint paramval bool : bool paramval string : string paramval user : ('a -> string) -> 'a paramval make_post_uri_components :
?absolute:bool ->
?absolute_path:bool ->
?https:bool ->
service:('get, 'post, Service.post, _, _, _, _, _, _, _, _) Service.t ->
?hostname:string ->
?port:int ->
?fragment:string ->
?keep_nl_params:[ `All | `Persistent | `None ] ->
?nl_params:Parameter.nl_params_set ->
?keep_get_na_params:bool ->
'get ->
'post ->
string
* (string * Mod_parameters.param) list
* string option
* (string * Mod_parameters.param) listSame as LINK.make_uri_components, but also returns a list of post parameters.
val get_form :
?absolute:bool ->
?absolute_path:bool ->
?https:bool ->
?a:[< Html_types.form_attrib ] attrib list ->
service:
(_, unit, Service.get, _, _, _, _, _, 'gn, _, Service.non_ocaml) Service.t ->
?hostname:string ->
?port:int ->
?fragment:string ->
?keep_nl_params:[ `All | `Persistent | `None ] ->
?nl_params:Parameter.nl_params_set ->
?xhr:bool ->
('gn -> [< Html_types.form_content ] elt list) ->
[> Html_types.form ] eltThe function get_form service formgen creates a GET <form> to service. The content of the <form> is generated by the function formgen, that takes the names of the service parameters as parameters. By default, the action attribute is a relative URL recomputed at each request with make_uri.
By default, the form is realized such that the client-side Eliom application keeps running irrespective of the usage of the form (cf. Client.change_page).
By contrast, if the optional parameter ~xhr:false is given, the form is realized as a standard HTML form and submitting it discontinues the Eliom application. The ~xhr parameter has no effect outside an Eliom application.
NB that the default value of ~xhr is configurable through Config.set_default_links_xhr.
The optional parameter ~a allows one to add extra HTML attributes to the generated node.
See make_uri for description of other optional parameters.
val lwt_get_form :
?absolute:bool ->
?absolute_path:bool ->
?https:bool ->
?a:[< Html_types.form_attrib ] attrib list ->
service:
(_, unit, Service.get, _, _, _, _, _, 'gn, _, Service.non_ocaml) Service.t ->
?hostname:string ->
?port:int ->
?fragment:string ->
?keep_nl_params:[ `All | `Persistent | `None ] ->
?nl_params:Parameter.nl_params_set ->
?xhr:bool ->
('gn -> [< Html_types.form_content ] elt list Lwt.t) ->
[> Html_types.form ] elt Lwt.tSame as get_form but taking a cooperative function for <form> content generation.
val post_form :
?absolute:bool ->
?absolute_path:bool ->
?https:bool ->
?a:[< Html_types.form_attrib ] attrib list ->
service:
('get, _, Service.post, _, _, _, _, _, _, 'pn, Service.non_ocaml) Service.t ->
?hostname:string ->
?port:int ->
?fragment:string ->
?keep_nl_params:[ `All | `Persistent | `None ] ->
?keep_get_na_params:bool ->
?nl_params:Parameter.nl_params_set ->
?xhr:bool ->
('pn -> [< Html_types.form_content ] elt list) ->
'get ->
[> Html_types.form ] eltThe function post_form service formgen post_params creates a POST <form> to service preapplied to the POST parameters post_params. The content of the <form> is generated by the function formgen, that takes the names of the service parameters as parameters. By default, the action attribute is a relative URL recomputed at each request with make_uri.
The optional parameter ~a allows one to add HTML attributes to the generated node.
See Service.make for a description of the ~keep_get_na_params optional parameter ; see get_form for ~xhr and see make_uri for other optional parameters.
val lwt_post_form :
?absolute:bool ->
?absolute_path:bool ->
?https:bool ->
?a:[< Html_types.form_attrib ] attrib list ->
service:
('get, _, Service.post, _, _, _, _, _, _, 'pn, Service.non_ocaml) Service.t ->
?hostname:string ->
?port:int ->
?fragment:string ->
?keep_nl_params:[ `All | `Persistent | `None ] ->
?keep_get_na_params:bool ->
?nl_params:Parameter.nl_params_set ->
?xhr:bool ->
('pn -> [< Html_types.form_content ] elt list Lwt.t) ->
'get ->
[> Html_types.form ] elt Lwt.tSame as post_form but taking a cooperative function for <form> content generation.
val input :
?a:[< Html_types.input_attrib ] attrib list ->
input_type:[< Html_types.input_type ] ->
?name:[< 'a Parameter.setoneradio ] Parameter.param_name ->
?value:'a ->
'a param ->
[> Html_types.input ] eltCreates an <input> tag.
val file_input :
?a:[< Html_types.input_attrib ] attrib list ->
name:[< Lib.file_info Parameter.setoneradio ] Parameter.param_name ->
unit ->
[> Html_types.input ] eltCreates an <input> tag for sending a file
val image_input :
?a:[< Html_types.input_attrib ] attrib list ->
name:[< Parameter.coordinates Parameter.oneradio ] Parameter.param_name ->
?src:uri ->
unit ->
[> Html_types.input ] eltCreates an <input type="image" name="..."> tag. The server receives the coordinates that the user clicked on.
val checkbox :
?a:[< Html_types.input_attrib ] attrib list ->
?checked:bool ->
name:[ `Set of 'a ] Parameter.param_name ->
value:'a ->
'a param ->
[> Html_types.input ] eltCreates a checkbox <input> tag. You can produce several checkboxes with the same name (and different values). The service must declare a parameter of type set.
val bool_checkbox_one :
?a:[< Html_types.input_attrib ] attrib list ->
?checked:bool ->
name:[ `One of bool ] Parameter.param_name ->
unit ->
[> Html_types.input ] eltCreates a checkbox <input> tag of type bool. Only one checkbox with the same name is allowed.
val radio :
?a:[< Html_types.input_attrib ] attrib list ->
?checked:bool ->
name:[ `Radio of 'a ] Parameter.param_name ->
value:'a ->
'a param ->
[> Html_types.input ] eltCreates a radio <input> tag.
val string_radio_required :
?a:[< Html_types.input_attrib ] attrib list ->
?checked:bool ->
name:[ `One of string ] Parameter.param_name ->
value:string ->
unit ->
[> Html_types.input ] eltval button :
?a:[< Html_types.button_attrib ] attrib list ->
button_type:[< Form_sigs.button_type ] ->
name:[< 'a Parameter.setone ] Parameter.param_name ->
value:'a ->
'a param ->
Html_types.button_content elt list ->
[> Html_types.button ] eltCreates a <button> tag.
val button_no_value :
?a:[< Html_types.button_attrib ] attrib list ->
button_type:[< Form_sigs.button_type ] ->
Html_types.button_content elt list ->
[> Html_types.button ] eltCreates a <button> tag with no value. No value is sent.
val textarea :
?a:[< Html_types.textarea_attrib ] attrib list ->
name:[< string Parameter.setoneradio ] Parameter.param_name ->
?value:string ->
unit ->
[> Html_types.textarea ] eltCreates a <textarea> tag
type 'a soption =
Html_types.option_attrib attrib list
* 'a
* Html_types.pcdata elt option
* booltype 'a select_opt = | Optgroup of [ Html_types.common | `Disabled ] attrib list * string * 'a soption * 'a soption list| Option of 'a soption
The type for <select> options and groups of options.
- The field of type 'a in
soptionis the value that will be sent by the form. - If the
Html_types.pcdata elt optionis not present it is also the value displayed. - The string in
select_optis the label
val select :
?a:[< Html_types.select_attrib ] attrib list ->
?required:Html_types.pcdata elt ->
name:[ `One of 'a ] Parameter.param_name ->
'a param ->
'a select_opt ->
'a select_opt list ->
[> Html_types.select ] eltCreates a <select> tag.
val multiple_select :
?a:[< Html_types.select_attrib ] attrib list ->
?required:Html_types.pcdata elt ->
name:[ `Set of 'a ] Parameter.param_name ->
'a param ->
'a select_opt ->
'a select_opt list ->
[> Html_types.select ] eltCreates a multiple-selection <select> tag.