default form values

This commit is contained in:
David Botton 2021-02-25 12:24:59 -05:00
parent 9fe95bbc5e
commit 17c28e43c2
2 changed files with 14 additions and 6 deletions

View file

@ -1439,8 +1439,8 @@ Special field types
============= ================== ============= ==================
:filename default dir -- NOTE: This is _server_ side! :filename default dir -- NOTE: This is _server_ side!
:checkbox t if checked :checkbox t if checked
:radiobox a-list ((label name)) :radiobox a-list ((label name)) a third value can be used to select
:select a-list ((label name)) :select a-list ((label name)) a third value can be used to select
:text value :text value
(any text input types also work :email, :tel, etc. (any text input types also work :email, :tel, etc.
see FORM-ELEMENT-TYPE) see FORM-ELEMENT-TYPE)
@ -1461,7 +1461,12 @@ if confirmed or nil if canceled."
(format nil "~{~A~}" (format nil "~{~A~}"
(mapcar (lambda (s) (mapcar (lambda (s)
(format nil (format nil
"<option value='~A'>~A</option>" (second s) (first s))) "<option value='~A' ~A>~A</option>"
(second s)
(if (third s)
(third s)
"")
(first s)))
(fourth l))))) (fourth l)))))
((eq (third l) :radio) ((eq (third l) :radio)
(format nil (format nil
@ -1471,11 +1476,14 @@ if confirmed or nil if canceled."
(mapcar (lambda (s) (mapcar (lambda (s)
(format nil (format nil
"<div><input type=radio class='w3-radio' name='~A-~A'~ "<div><input type=radio class='w3-radio' name='~A-~A'~
id='~A-~A-~A' value='~A'> ~ id='~A-~A-~A' value='~A' ~A> ~
<label for='~A-~A-~A'>~A</label></div>" <label for='~A-~A-~A'>~A</label></div>"
html-id (second l) html-id (second l)
html-id (second l) (second s) html-id (second l) (second s)
(second s) (second s)
(if (third s)
(third s)
"")
html-id (second l) (second s) html-id (second l) (second s)
(first s))) (first s)))
(fourth l))))) (fourth l)))))

View file

@ -75,12 +75,12 @@
(defun on-dlg-form (obj) (defun on-dlg-form (obj)
(form-dialog obj "Please enter your information." (form-dialog obj "Please enter your information."
'(("Title" "title" :select (("Mr." "mr") '(("Title" "title" :select (("Mr." "mr")
("Mrs." "mrs") ("Mrs." "mrs" :selected)
("Ms." "ms") ("Ms." "ms")
("Other" "other"))) ("Other" "other")))
("Eye Color" "color" :radio (("Blue" "blue") ("Eye Color" "color" :radio (("Blue" "blue")
("Brown" "brown") ("Brown" "brown")
("Green" "green") ("Green" "green" :checked)
("Other" "other"))) ("Other" "other")))
("Send Mail" "send-mail" :checkbox t) ("Send Mail" "send-mail" :checkbox t)
("Name" "name" :text "Real Name") ("Name" "name" :text "Real Name")