[plt-scheme] Formlet problem with PLT Web Server

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Mon Aug 3 23:14:36 EDT 2009

What am I doing wrong here? I've gotten the code down to a really
small example, but I think I'm missing something minor.

------------------------
#lang web-server/insta

(require web-server/formlets)

(define login-formlet
  (formlet
   (div
    "Username:" ,{(to-string (required (text-input))) . => . username}
    "Password:" ,{(to-string (required (password-input))) . => . password})
   (list username password)))

(define (start req)
  `(html (head (title "Home Page"))
         (body (h1 "Home Page")
               ,(formlet-display login-formlet))))
--------------------------

Running this gives this error:

you broke the contract xexpr? on start; Not an Xexpr. Expected a
symbol as the element name, given (div () "Username:" (input ((name
"input_0") (type "text"))) "Password:" (input ((name "input_1") (type
"text"))))

It looks like there's an extra () in the formlet-display result that's
not there in the docs here:

http://docs.plt-scheme.org/web-server/formlets.html#(part._.Basic_.Formlet_.Usage)

Thanks,
Todd

P.S. Yes, I know I'm missing a <form> tag and all kinds of other
stuff. I just want to see if I can display the inputs before I do all
the rest of the stuff.


Posted on the users mailing list.