From e3dcb4caadb3b1468a311f056201162e1edb3200 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Fri, 19 Apr 2024 20:55:50 +0200 Subject: [PATCH] Fix form macro --- src/component/form.lisp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/component/form.lisp b/src/component/form.lisp index 71ad5b2..3f7b370 100644 --- a/src/component/form.lisp +++ b/src/component/form.lisp @@ -65,8 +65,10 @@ ;;; form -(defmacro form ((&optional (attr nil)) &body body) - "Generates HTML form elements using Spinneret library. +(defmacro form (legend &optional attr &body body) + "Generates HTML form element. + +LEGEND: Add text for . A short description for forms. ATTR: A list of form attributes like :action, :name and :method. If not provided, defaults to an empty action, \"html-form\" as name and \"post\" as method. @@ -74,10 +76,11 @@ defaults to an empty action, \"html-form\" as name and \"post\" as method. BODY: The body of the form, which generally includes form elements such as input fields, checkboxes, radio buttons, etc." `(spinneret:with-html - (:form ,@(if (listp attr) + (:form ,@(if (not (null attr)) attr (list :action "" :name "html-form" :method "post")) - (:fieldset ,@body)))) + (:fieldset (:legend ,legend) + ,@body)))) ;;; checkable