chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Newbie HTML-form questions


From: Basile STARYNKEVITCH
Subject: [Chicken-users] Newbie HTML-form questions
Date: Thu, 11 Dec 2008 09:21:31 +0100
User-agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018)

Hello All,

(I'm sending a couple of questions, each unrelated question in a separate email. I hope it is right).

Again some newbie questions regarding Chcken and HTML/HTTP:

* using html-form and http-server, how do I conveinently build a simple login HTML form (with the usual two fields username and password). I e what is the code that I can call from a http:add-resource


   (http:add-resource
    "/login"
    (lambda (req alis)
      (if (eq? (http:request-method req) 'POST)
          (let* ( (username (assoc 'USER alis))
              (password (assoc 'PASSWD alis))
              (userdata (valid-user-password username passwd))
              )
        (if userdata
            (let (  (newsid (http-session:create ".*"))
                )
              (http:write-response-header req
   ;;;; I want to display a simple "Welcome to" USERNAME page here
              )
            (begin
  ;;;; I want to display a simple "Bad user or password" page here.
              )))
          (let ( (loginmsg #f)
;;;; I want to display a simple "Login User = ... Password = ...." form with one text HTML entry and one password entry
             )
        (assert "install-fixed-http get not impl")
        )))
    )

My point is that I want to use html-form or wart to display forms (I don't want to just printf or write them). I did got once an example, but I forgot where and was not able to find it again :-(

Apparently html-form gives a structured HTML form, not a string which I could display; And I'm looking for the function to output it on (current-output).

I actually suggest that the examples in http://chicken.wiki.br/http#http-server would also include a HTML form and also that code in http://chicken.wiki.br/html-form would illustrate how to output an entire HTML page with a single form

I am not sure to understand in http://chicken.wiki.br/http#http-server how to get a cookie in a request or set it in a reply. I suppose I need to use http:request-attributes

If there is a not too big but not too trivial Web application (i.e. less than 1KLOC) in Chicken using http & html-form I would be grateful to glance at it.

Thanks for reading.
Regards.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***





reply via email to

[Prev in Thread] Current Thread [Next in Thread]