Form Data and Query Strings

Author(s): The Ciao Development Team.

This module implements a printer/parser for query strings and multipart/form-data contents of HTTP requests.

Query strings are typically encoded in the URLs of GET messages. Form-data is encoded in the contents of POST messages. Both are useful to send list of name=value information in HTTP requests (originally from HTML forms, lately for many other uses).

Documentation on exports

Usage:form_dict(Dict)

Dict is a dictionary of values of the attributes of a form. It is a list of form_assignment

    Usage:form_assignment(Eq)

    Eq is an assignment of value of an attribute of a form. It is defined by:

    form_assignment(A=V) :-
            atm(A),
            form_value(V).
    
    form_value(A) :-
            atm(A).
    form_value(N) :-
            num(N).
    form_value(L) :-
            list(L,string).
    

      Usage:form_value(V)

      V is a value of an attribute of a form.

        Usage:value_dict(Dict)

        Dict is a dictionary of values. It is a list of pairs atom=constant.

          get_form_value(Dict,Var,Val)

          Unifies Val with the value for attribute Var in dictionary Dict. Does not fail: value is if not found (this simplifies the programming of form handlers when they can be accessed directly).

          Usage:

          • Call and exit should be compatible with:
            (http_forms:form_value/1)Val is a value of an attribute of a form.
          • The following properties should hold at call time:
            (http_forms:form_dict/1)Dict is a dictionary of values of the attributes of a form. It is a list of form_assignment
            (basic_props:atm/1)Var is an atom.
          • The following properties should hold upon exit:
            (http_forms:form_value/1)Val is a value of an attribute of a form.

          get_form_value_string(Dict,Var,Val)

          Like get_form_value/3 but obtain Val as a string.

          Usage:

          • Call and exit should be compatible with:
            (basic_props:string/1)Val is a string (a list of character codes).
          • The following properties should hold at call time:
            (http_forms:form_dict/1)Dict is a dictionary of values of the attributes of a form. It is a list of form_assignment
            (basic_props:atm/1)Var is an atom.
          • The following properties should hold upon exit:
            (basic_props:string/1)Val is a string (a list of character codes).

          get_form_value_atm(Dict,Var,Val)

          Like get_form_value/3 but obtain Val as an atom.

          Usage:

          Usage:form_empty_value(Term)

          Checks that Term, a value comming from a text area is empty (can have spaces, newlines and linefeeds).

            Usage:form_default(Val,Default,NewVal)

            Useful when a form is only partially filled, or when the executable can be invoked either by a link or by a form, to set form defaults. If the value of Val is empty then NewVal=Default, else NewVal=Val.

            url_query_values(URLArgs,Dict)

            Dict is a dictionary of parameter values and URLArgs is the URL-encoded string of those assignments, which may appear after an URL pointing to a CGI script preceded by a '?'. Dict is computed according to the raw_form_values flag. The use of this predicate is reversible.

            Usage 1:

            • The following properties should hold at call time:
              (term_typing:var/1)URLArgs is a free variable.
              (http_forms:value_dict/1)Dict is a dictionary of values. It is a list of pairs atom=constant.
            • The following properties should hold upon exit:
              (basic_props:string/1)URLArgs is a string (a list of character codes).

            Usage 2:

            • The following properties should hold at call time:
              (basic_props:string/1)URLArgs is a string (a list of character codes).
              (term_typing:var/1)Dict is a free variable.
            • The following properties should hold upon exit:
              (http_forms:value_dict/1)Dict is a dictionary of values. It is a list of pairs atom=constant.

            No further documentation available for this predicate.

            No further documentation available for this predicate.

            No further documentation available for this predicate.

            Usage:http_parse_form(Request,Dic)

            Get form data Dic from HTTP request Request

              Documentation on multifiles

              PREDICATEdefine_flag/3
              Defines a flag as follows:
              define_flag(raw_form_values,[on,off],off).
              
              (See Changing system behaviour and various flags).

              If flag is on, values returned by http_parse_form/2 are always atoms, unchanged from its original value.

              Usage:define_flag(Flag,FlagValues,Default)

              The predicate is multifile.

              Documentation on imports

              This module has the following direct dependencies: