Add with-form macro
This commit is contained in:
parent
4a302c7571
commit
b69746436f
1 changed files with 21 additions and 1 deletions
|
@ -61,7 +61,8 @@
|
|||
:ctrl-url
|
||||
:ctrl-week
|
||||
:ctrl-element
|
||||
:search-form))
|
||||
:search-form
|
||||
:with-form))
|
||||
|
||||
(in-package :dev.metalisp.sbt/form)
|
||||
|
||||
|
@ -486,3 +487,22 @@ Example 1:
|
|||
collect `(:option ,value))))
|
||||
`(progn ,@(loop for value in values
|
||||
collect `(:li (apply-input-form ,type ,group ,value))))))))))))
|
||||
|
||||
(defmacro with-form (&body body)
|
||||
"Create a standardized HTML form wrapped in a <main> tag with a pre-defined
|
||||
class and structure, using the Spinneret library. The form is designed to be
|
||||
used within a web application served by Hunchentoot, utilizing common layout
|
||||
and localization practices. The macro automatically sets the form’s action to
|
||||
the current request URI and expects certain functions and variables to be
|
||||
available in its environment for full functionality."
|
||||
`(spinneret:with-html
|
||||
(:main :id "main-content"
|
||||
:class "container my-5"
|
||||
(:p "Please fill out the following forms and press the submit button.")
|
||||
;; action is defined as hunchentoot:request-uri* function
|
||||
(:form :action (request-uri*)
|
||||
:method "post"
|
||||
:class (spacing :property "m" :side "y" :size 5)
|
||||
,@body
|
||||
(btn-primary (:type "submit")
|
||||
(find-l10n "submit" ml-survey:*html-lang* *l10n*))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue