function using cl-who:with-html-output ignoring parameter
- by shanked
I'm not sure whether this is an issue with my use of cl-who (specifically with-html-output-to-string and with-html-output) or an issue with my understanding of Common Lisp (as this is my first project using Lisp).
I created a function to create form fields:
(defun form-field (type name label)
(cl-who:with-html-output (*standard-output* nil)
(:div :class "field"
(:label :for name label)
(:input :type type :name name))))
When using this function, ie: (form-field "text" "username" "Username") the parameter label seems to be ignored... the HTML output is:
<div class="field"><label for="username"></label>
<input type="text" name="username"/></div>
instead of the expected output:
<div class="field"><label for="username">Username</label>
<input type="text" name="username"/></div>
If I modify the function and add a print statement:
(defun form-field (type name label)
(cl-who:with-html-output (*standard-output* nil)
(print label)
(:div :class "field"
(:label :for name label)
(:input :type type :name name))))
The "Username" string is successfully output (but still ignored in the HTML)... any ideas what might cause this?
Keep in mind, I'm calling this function within a cl-who:with-html-output-to-string for use with hunchentoot.