sunet/scheme/httpd/surflets/web-server/root/surflets/test.scm

50 lines
1.1 KiB
Scheme

(define-structure surflet surflet-interface
(open scheme-with-scsh
surflets
httpd-responses)
(begin
(define select (make-select-input-field '("a" "b" "c") #t '(@ (size 2))))
(define (main req)
(let ((req (send-html/suspend
(lambda (new-url)
`(html (body (h1 "This is from SUrflet")
(surflet-form
,new-url
POST
,select
,(make-submit-button))
(hr)
(p (URL "/" "Return to main menu."))
)))))
(save-k #f)
(done? #f))
(call-with-current-continuation
(lambda (k)
(set! save-k k)
13))
(if (not done?)
(begin
(send-html/suspend
(lambda (continue)
`(html (body (h1 "Result")
,(format #f "~s" (get-bindings req)) (br)
(URL ,continue "show results again")
(hr)
(p (URL "test.scm" "Test again.") (br)
(URL "/" "Return to main menu."))))))
(set! done? #t)
(save-k 13))
(send-html/finish
`(html (body (h1 "Result 2")
,(format #f "~s" (get-bindings req))
(hr)
(p (URL "test.scm" "Test again.") (br)
(URL "/" "Return to main menu."))))))))
))