From 17c28e43c2425db97c1fc545ef02417ce6159603 Mon Sep 17 00:00:00 2001 From: David Botton Date: Thu, 25 Feb 2021 12:24:59 -0500 Subject: [PATCH] default form values --- source/clog-gui.lisp | 16 ++++++++++++---- tutorial/22-tutorial.lisp | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/source/clog-gui.lisp b/source/clog-gui.lisp index ef3a546..b3d7970 100644 --- a/source/clog-gui.lisp +++ b/source/clog-gui.lisp @@ -1439,8 +1439,8 @@ Special field types ============= ================== :filename default dir -- NOTE: This is _server_ side! :checkbox t if checked - :radiobox a-list ((label name)) - :select a-list ((label name)) + :radiobox a-list ((label name)) a third value can be used to select + :select a-list ((label name)) a third value can be used to select :text value (any text input types also work :email, :tel, etc. see FORM-ELEMENT-TYPE) @@ -1461,7 +1461,12 @@ if confirmed or nil if canceled." (format nil "~{~A~}" (mapcar (lambda (s) (format nil - "" (second s) (first s))) + "" + (second s) + (if (third s) + (third s) + "") + (first s))) (fourth l))))) ((eq (third l) :radio) (format nil @@ -1471,11 +1476,14 @@ if confirmed or nil if canceled." (mapcar (lambda (s) (format nil "
~ + id='~A-~A-~A' value='~A' ~A> ~
" html-id (second l) html-id (second l) (second s) (second s) + (if (third s) + (third s) + "") html-id (second l) (second s) (first s))) (fourth l))))) diff --git a/tutorial/22-tutorial.lisp b/tutorial/22-tutorial.lisp index 07b1447..ccee38e 100644 --- a/tutorial/22-tutorial.lisp +++ b/tutorial/22-tutorial.lisp @@ -75,12 +75,12 @@ (defun on-dlg-form (obj) (form-dialog obj "Please enter your information." '(("Title" "title" :select (("Mr." "mr") - ("Mrs." "mrs") + ("Mrs." "mrs" :selected) ("Ms." "ms") ("Other" "other"))) ("Eye Color" "color" :radio (("Blue" "blue") ("Brown" "brown") - ("Green" "green") + ("Green" "green" :checked) ("Other" "other"))) ("Send Mail" "send-mail" :checkbox t) ("Name" "name" :text "Real Name")