~pkal/ecg

27321183ee8d93129d278d369ec2acefcdafce62 — Philip Kaludercic 3 months ago 035cc00
Distinguish radio buttons and their labels
1 files changed, 10 insertions(+), 8 deletions(-)

M ecg.lisp
M ecg.lisp => ecg.lisp +10 -8
@@ 117,14 117,16 @@
          (with-html-output (*standard-output*)
            (:div
             (:p (esc question))
             (dolist (alt alternatives)
               (htm
                (:div
                 (:input :value (if (consp alt) (cdr alt) alt)
                         :checked (equal (if (consp alt) (cdr alt) alt) default)
                         :type "radio" :name name :id name)
                 " "
                 (:label :for name (str (if (consp alt) (car alt) alt))))))))
             (let ((i 0))
               (dolist (alt alternatives)
                 (htm
                  (:div
                   (:input :value (if (consp alt) (cdr alt) alt)
                           :checked (equal (if (consp alt) (cdr alt) alt) default)
                           :type "radio" :name name :id (format nil "~s-~d" name i))
                   " "
                   (:label :for (format nil "~s-~d" name i) (str (if (consp alt) (car alt) alt)))))
                 (incf i)))))
          (with-html-output (*standard-output*)
            (:div
             (:label :for name (esc question) ": ")