[racket] how to display formlets inside templates
Hi,
sorry for coming with a web server-related question again already, but I have problems figuring out how to display formlets inside templates.
I've tried several ways, the latest being:
...
(send/suspend/dispatch
(lambda (make-url)
(get-main-template #:title "start"
#:main (include-template "choose-db-form.html")))))
where I have one function providing the "general html template":
(define (get-main-template #:title (title "") #:top (top "") #:left (left "") #:main (main "") #:right (right "") #:footer (footer ""))
(response/full
200 #"Okay"
(current-seconds) TEXT/HTML-MIME-TYPE
empty
(list (string->bytes/utf-8 (include-template "main.html")))))
and include a sub-template for the body, which should contain a form provided by a formlet looking like this:
(define f-choose-db
(formlet
(#%# ,((radiogroup-input '(orcl rndba)) . => . db)
,(input-string . => . user)
,(input-string . => . pw)
,((submit #"submit") . => . sm))
(list db user pw)))
As the sub-template, I've tried
<div>
<p>@|errortext|</p>
<form action="@(make-url connect-handler)">
@(formlet-display f-choose-db)
</form>
</div>
which I understand does not look like it could work - formlet-display, when called alone, displaying with parentheses and not as html - but still I don't know how to do it - for example, I cannot call xexpr->xml on the displayed formlet because it's not an xexpr...
Could someone give me a hint how to do it?
Many thanks in advance,
Sigrid