In my Racket web-server/insta app, I have some repetitive <div>
HTML that I want to factor out into a separate function and then call it with params to generate the div HTML inside a larger HTML xexpr. All that I get on the web page when I do this are the two parameter strings. How can I factor the <div>
code out?
I tried simply calling the function from the quoted expression.
I also tried adding a response/xexpr in front of the quoted <div>
code in the div function, but no go.
;; I want to factor the <div>
out of this code into a separate function.
(define (start request)
(response/xexpr
'(html (head (title "Testing")
(body (form
(div ((class "form-group"))
(label ((for "public-id")) "Public Id")
(input ((type "text")
(name "public-id")
(id "public-id")
(placeholder "Enter public id"))))
;; I tried doing that with this function, both with and without the "response/xexpr" code.
(define (input-field-html fld-name-id fld-caption)
(response/xexpr
'(div ((class "form-group"))
(label ((for fld-name-id)) "Public Id")
(input ((type "text")
(name fld-name-id)
(placeholder fld-caption))))))