This is client API (go to server)

Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module type Eliom_form_sigs.​S

module type S = sig..end

type 'a param
type +'a elt
type +'a attrib
type uri
val float : float param
val int : int param
val int32 : int32 param
val int64 : int64 param
val nativeint : nativeint param
val bool : bool param
val string : string param
val make_post_uri_components : 
  ?absolute:bool ->
  ?absolute_path:bool ->
  ?https:bool ->
  service:('get, 'post, [< Eliom_service.post_service_kind ],
   [< Eliom_service.attached ], [< Eliom_service.service_kind ],
   [< Eliom_service.suff ], 'gn, 'pn,
   [< Eliom_service.registrable ], 'return)
   Eliom_service.service ->
  ?hostname:string ->
  ?port:int ->
  ?fragment:string ->
  ?keep_nl_params:[ `All | `None | `Persistent ] ->
  ?nl_params:Eliom_parameter.nl_params_set ->
  ?keep_get_na_params:bool ->
  'get ->
  'post ->
  string * (string * Eliommod_parameters.param) list * string option *
  (string * Eliommod_parameters.param) list

Same as LINK.make_uri_components, but also returns a list of post parameters.

val get_form : 
  ?absolute:bool ->
  ?absolute_path:bool ->
  ?https:bool ->
  ?a:Html5_types.form_attrib attrib list ->
  service:('get, unit, [< Eliom_service.get_service_kind ],
   [< Eliom_service.attached ], [< Eliom_service.service_kind ],
   [< Eliom_service.suff ], 'gn, 'pn,
   [< Eliom_service.registrable ],
   [< Eliom_service.non_ocaml_service ])
   Eliom_service.service ->
  ?hostname:string ->
  ?port:int ->
  ?fragment:string ->
  ?keep_nl_params:[ `All | `None | `Persistent ] ->
  ?nl_params:Eliom_parameter.nl_params_set ->
  ?xhr:bool ->
  ('gn -> Html5_types.form_content elt list) ->
  [> Html5_types.form ] elt

The function post_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 irrespectable of the usage of the form (cf. Eliom_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 <<a_api project="eliom" subproject="server" | val Eliom_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:Html5_types.form_attrib attrib list ->
  service:('get, unit, [< Eliom_service.get_service_kind ],
   [< Eliom_service.attached ], [< Eliom_service.service_kind ],
   [< Eliom_service.suff ], 'gn, 'pn,
   [< Eliom_service.registrable ],
   [< Eliom_service.non_ocaml_service ])
   Eliom_service.service ->
  ?hostname:string ->
  ?port:int ->
  ?fragment:string ->
  ?keep_nl_params:[ `All | `None | `Persistent ] ->
  ?nl_params:Eliom_parameter.nl_params_set ->
  ?xhr:bool ->
  ('gn -> Html5_types.form_content elt list Lwt.t) ->
  [> Html5_types.form ] elt Lwt.t

Same as Eliom_form_sigs.​S.​get_form but taking a cooperative function for <form> content generation.

val post_form : 
  ?absolute:bool ->
  ?absolute_path:bool ->
  ?https:bool ->
  ?a:Html5_types.form_attrib attrib list ->
  service:('get, 'post, [< Eliom_service.post_service_kind ],
   [< Eliom_service.attached ], [< Eliom_service.service_kind ],
   [< Eliom_service.suff ], 'gn, 'pn,
   [< Eliom_service.registrable ],
   [< Eliom_service.non_ocaml_service ])
   Eliom_service.service ->
  ?hostname:string ->
  ?port:int ->
  ?fragment:string ->
  ?keep_nl_params:[ `All | `None | `Persistent ] ->
  ?keep_get_na_params:bool ->
  ?nl_params:Eliom_parameter.nl_params_set ->
  ?xhr:bool ->
  ('pn -> Html5_types.form_content elt list) ->
  'get -> [> Html5_types.form ] elt

The function post_form service formgen get_params creates a POST <form> to service preapplied to the GET parameters get_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 Eliom_service.​Http.​post_coservice' for a description of the ~keep_get_na_params optional parameter ; see Eliom_form_sigs.​S.​get_form for ~xhr and see make_uri for other optional parameters.

val lwt_post_form : 
  ?absolute:bool ->
  ?absolute_path:bool ->
  ?https:bool ->
  ?a:Html5_types.form_attrib attrib list ->
  service:('get, 'post, [< Eliom_service.post_service_kind ],
   [< Eliom_service.attached ], [< Eliom_service.service_kind ],
   [< Eliom_service.suff ], 'gn, 'pn,
   [< Eliom_service.registrable ],
   [< Eliom_service.non_ocaml_service ])
   Eliom_service.service ->
  ?hostname:string ->
  ?port:int ->
  ?fragment:string ->
  ?keep_nl_params:[ `All | `None | `Persistent ] ->
  ?keep_get_na_params:bool ->
  ?nl_params:Eliom_parameter.nl_params_set ->
  ?xhr:bool ->
  ('pn -> Html5_types.form_content elt list Lwt.t) ->
  'get -> [> Html5_types.form ] elt Lwt.t

Same as Eliom_form_sigs.​S.​post_form but taking a cooperative function for <form> content generation.

val input : 
  ?a:Html5_types.input_attrib attrib list ->
  input_type:[< Html5_types.input_type ] ->
  ?name:[< 'a Eliom_parameter.setoneradio ] Eliom_parameter.param_name ->
  ?value:'a ->
  'a param ->
  [> Html5_types.input ] elt

Creates an <input> tag.

val file_input : 
  ?a:Html5_types.input_attrib attrib list ->
  name:[< Eliom_lib.file_info Eliom_parameter.setoneradio ]
   Eliom_parameter.param_name ->
  unit -> [> Html5_types.input ] elt

Creates an <input> tag for sending a file

val image_input : 
  ?a:Html5_types.input_attrib attrib list ->
  name:[< Eliom_parameter.coordinates Eliom_parameter.oneradio ]
   Eliom_parameter.param_name ->
  ?src:uri ->
  unit -> [> Html5_types.input ] elt

Creates an <input type="image" name="..."> tag. The server receives the coordinates that the user clicked on.

val checkbox : 
  ?a:Html5_types.input_attrib attrib list ->
  ?checked:bool ->
  name:[ `Set of 'a ] Eliom_parameter.param_name ->
  value:'a ->
  'a param ->
  [> Html5_types.input ] elt

Creates 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:Html5_types.input_attrib attrib list ->
  ?checked:bool ->
  name:[ `One of bool ] Eliom_parameter.param_name ->
  unit -> [> Html5_types.input ] elt

Creates a checkbox <input> tag of type bool. Only one checkbox with the same name is allowed.

val radio : 
  ?a:Html5_types.input_attrib attrib list ->
  ?checked:bool ->
  name:[ `Radio of 'a ] Eliom_parameter.param_name ->
  value:'a ->
  'a param ->
  [> Html5_types.input ] elt

Creates a radio <input> tag.

val string_radio_required : 
  ?a:Html5_types.input_attrib attrib list ->
  ?checked:bool ->
  name:[ `One of string ] Eliom_parameter.param_name ->
  value:string -> unit -> [> Html5_types.input ] elt
val button : 
  ?a:Html5_types.button_attrib attrib list ->
  button_type:[< Eliom_form_sigs.button_type ] ->
  name:[< 'a Eliom_parameter.setone ] Eliom_parameter.param_name ->
  value:'a ->
  'a param ->
  Html5_types.button_content elt list ->
  [> Html5_types.button ] elt

Creates a <button> tag.

val button_no_value : 
  ?a:Html5_types.button_attrib attrib list ->
  button_type:[< Eliom_form_sigs.button_type ] ->
  Html5_types.button_content elt list ->
  [> Html5_types.button ] elt

Creates a <button> tag with no value. No value is sent.

val textarea : 
  ?a:Html5_types.textarea_attrib attrib list ->
  name:[< string Eliom_parameter.setoneradio ]
   Eliom_parameter.param_name ->
  ?value:string ->
  unit -> [> Html5_types.textarea ] elt

Creates a <textarea> tag

type 'a soption = 
  Html5_types.option_attrib attrib list * 'a *
  Html5_types.pcdata elt option * bool
type 'a select_opt =  | Optgroup of 
    [ `Accesskey
    | `Class
    | `Contenteditable
    | `Contextmenu
    | `Dir
    | `Disabled
    | `Draggable
    | `Hidden
    | `Id
    | `Lang
    | `OnAbort
    | `OnBlur
    | `OnCanPlay
    | `OnCanPlayThrough
    | `OnChange
    | `OnClick
    | `OnContextMenu
    | `OnDblClick
    | `OnDrag
    | `OnDragEnd
    | `OnDragEnter
    | `OnDragLeave
    | `OnDragOver
    | `OnDragStart
    | `OnDrop
    | `OnDurationChange
    | `OnEmptied
    | `OnEnded
    | `OnError
    | `OnFocus
    | `OnFormChange
    | `OnFormInput
    | `OnInput
    | `OnInvalid
    | `OnKeyDown
    | `OnKeyPress
    | `OnKeyUp
    | `OnLoad
    | `OnLoadStart
    | `OnLoadedData
    | `OnLoadedMetaData
    | `OnMouseDown
    | `OnMouseMove
    | `OnMouseOut
    | `OnMouseOver
    | `OnMouseUp
    | `OnMouseWheel
    | `OnPause
    | `OnPlay
    | `OnPlaying
    | `OnProgress
    | `OnRateChange
    | `OnReadyStateChange
    | `OnScroll
    | `OnSeeked
    | `OnSeeking
    | `OnSelect
    | `OnShow
    | `OnStalled
    | `OnSubmit
    | `OnSuspend
    | `OnTimeUpdate
    | `OnVolumeChange
    | `OnWaiting
    | `Spellcheck
    | `Style_Attr
    | `Tabindex
    | `Title
    | `User_data
    | `XML_lang
    | `XMLns ] 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 soption is the value that will be sent by the form.
  • If the Html5_types.pcdata elt option is not present it is also the value displayed.
  • The string in select_opt is the label
val select : 
  ?a:Html5_types.select_attrib attrib list ->
  ?required:Html5_types.pcdata elt ->
  name:[ `One of 'a ] Eliom_parameter.param_name ->
  'a param ->
  'a select_opt ->
  'a select_opt list ->
  [> Html5_types.select ] elt

Creates a <select> tag.

val multiple_select : 
  ?a:Html5_types.select_attrib attrib list ->
  ?required:Html5_types.pcdata elt ->
  name:[ `Set of 'a ] Eliom_parameter.param_name ->
  'a param ->
  'a select_opt ->
  'a select_opt list ->
  [> Html5_types.select ] elt

Creates a multiple-selection <select> tag.