mirror of
https://github.com/rabbibotton/clog.git
synced 2026-04-27 15:40:51 -07:00
All form properties in settings
This commit is contained in:
parent
f27de22895
commit
9cf4bac66f
3 changed files with 129 additions and 29 deletions
|
|
@ -117,7 +117,9 @@ action."))
|
|||
(:documentation "Set autocompletep for CLOG-FORM"))
|
||||
|
||||
(defmethod set-autocompletep ((obj clog-form) autocompletep)
|
||||
(setf (property obj "autocompletep") (p-on-js autocompletep)))
|
||||
(if value
|
||||
(setf (attribute obj "autocomplete") "true")
|
||||
(remove-attribute obj "autocomplete")))
|
||||
(defsetf autocompletep set-autocompletep)
|
||||
|
||||
;;;;;;;;;;;;;;
|
||||
|
|
@ -154,7 +156,9 @@ action."))
|
|||
(:documentation "Set VALIDATE-ON-SUBMIT for CLOG-FORM"))
|
||||
|
||||
(defmethod set-validate-on-submit ((obj clog-form) value)
|
||||
(setf (property obj "noValidate") (p-true-js (not value))))
|
||||
(if (not value)
|
||||
(setf (attribute obj "noValidate") "true")
|
||||
(remove-attribute obj "noValidate")))
|
||||
(defsetf validate-on-submit set-validate-on-submit)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
@ -220,7 +224,9 @@ clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME."))
|
|||
(:documentation "Set autocomplete AUTOCOMPLETE for CLOG-FORM-ELEMENT"))
|
||||
|
||||
(defmethod set-autocomplete ((obj clog-form-element) value)
|
||||
(setf (property obj "autocomplete") value))
|
||||
(if value
|
||||
(setf (attribute obj "autocomplete") "true")
|
||||
(remove-attribute obj "autocomplete")))
|
||||
(defsetf autocomplete set-autocomplete)
|
||||
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
|
@ -229,7 +235,7 @@ clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME."))
|
|||
|
||||
(defgeneric autofocusp (clog-form-element)
|
||||
(:documentation "Get/Setf form element autofocusp. Only one element should
|
||||
have this set true. Autofocus on element when form loaded. "))
|
||||
have this set true ever. Autofocus on element when form loaded."))
|
||||
|
||||
(defmethod autofocusp ((obj clog-form-element))
|
||||
(js-true-p (attribute obj "autofocus")))
|
||||
|
|
@ -274,7 +280,9 @@ have this set true. Autofocus on element when form loaded. "))
|
|||
(:documentation "Set disabledp DISABLEDP for CLOG-FORM-ELEMENT"))
|
||||
|
||||
(defmethod set-disabledp ((obj clog-form-element) value)
|
||||
(setf (property obj "disabled") (p-true-js value)))
|
||||
(if value
|
||||
(setf (attribute obj "disabled") "true")
|
||||
(remove-attribute obj "disabled")))
|
||||
(defsetf disabledp set-disabledp)
|
||||
|
||||
;;;;;;;;;;;;;;;;;
|
||||
|
|
@ -291,7 +299,9 @@ have this set true. Autofocus on element when form loaded. "))
|
|||
(:documentation "Set read-only-p READ-ONLY-P for CLOG-FORM-ELEMENT"))
|
||||
|
||||
(defmethod set-read-only-p ((obj clog-form-element) value)
|
||||
(setf (property obj "readonly") (p-true-js value)))
|
||||
(if value
|
||||
(setf (attribute obj "readonly") "true")
|
||||
(remove-attribute obj "readonly")))
|
||||
(defsetf read-only-p set-read-only-p)
|
||||
|
||||
;;;;;;;;;;;;;;;
|
||||
|
|
@ -308,9 +318,30 @@ have this set true. Autofocus on element when form loaded. "))
|
|||
(:documentation "Set requiredp REQUIREDP for CLOG-FORM-ELEMENT"))
|
||||
|
||||
(defmethod set-requiredp ((obj clog-form-element) value)
|
||||
(setf (property obj "required") (p-true-js value)))
|
||||
(if value
|
||||
(setf (attribute obj "required") "true")
|
||||
(remove-attribute obj "required")))
|
||||
(defsetf requiredp set-requiredp)
|
||||
|
||||
;;;;;;;;;;;;;;;
|
||||
;; multiplep ;;
|
||||
;;;;;;;;;;;;;;;
|
||||
|
||||
(defgeneric multiplep (clog-form-element)
|
||||
(:documentation "Get/Setf form element multiplep."))
|
||||
|
||||
(defmethod multiplep ((obj clog-form-element))
|
||||
(js-true-p (property obj "multiple")))
|
||||
|
||||
(defgeneric set-multiplep (clog-form-element value)
|
||||
(:documentation "Set multiplep MULTIPLEP for CLOG-FORM-ELEMENT"))
|
||||
|
||||
(defmethod set-multiplep ((obj clog-form-element) value)
|
||||
(if value
|
||||
(setf (attribute obj "multiple") "true")
|
||||
(remove-attribute obj "multiple")))
|
||||
(defsetf multiplep set-multiplep)
|
||||
|
||||
;;;;;;;;;;
|
||||
;; name ;;
|
||||
;;;;;;;;;;
|
||||
|
|
@ -641,7 +672,9 @@ the File form element type.
|
|||
(:documentation "Set VALUE if checkedp for CLOG-FORM-ELEMENT"))
|
||||
|
||||
(defmethod set-checkedp ((obj clog-form-element) value)
|
||||
(setf (property obj "checked") (p-true-js value)))
|
||||
(if value
|
||||
(setf (attribute obj "checked") "true")
|
||||
(remove-attribute obj "checked")))
|
||||
(defsetf checkedp set-checkedp)
|
||||
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
|
|
|||
|
|
@ -524,6 +524,7 @@ embedded in a native template application.)"
|
|||
(disabledp generic-function)
|
||||
(read-only-p generic-function)
|
||||
(requiredp generic-function)
|
||||
(multiplep generic-function)
|
||||
(name generic-function)
|
||||
(default-value generic-function)
|
||||
(value generic-function)
|
||||
|
|
|
|||
|
|
@ -55,28 +55,72 @@
|
|||
(defparameter *props-value*
|
||||
`((:name "value"
|
||||
:setf clog:value)
|
||||
(:name "form name"
|
||||
(:name "name on form"
|
||||
:setf clog:name)
|
||||
(:name "type"
|
||||
:setup ,(lambda (control td1 td2)
|
||||
(declare (ignore td1))
|
||||
(let ((dd (create-select td2))
|
||||
(v (string-downcase (attribute control "type"))))
|
||||
(add-select-options dd `(,v
|
||||
"button" "checkbox" "color" "date"
|
||||
"datetime" "datetime-local" "email"
|
||||
"image" "file" "hidden" "image"
|
||||
"month" "number" "password" "radio"
|
||||
"range" "reset" "search" "submit"
|
||||
"tel" "text" "time" "url" "week"))
|
||||
(set-on-change dd (lambda (obj)
|
||||
(declare (ignore obj))
|
||||
(setf (attribute control "type") (value dd))
|
||||
(set-geometry (get-placer control)
|
||||
:top (position-top control)
|
||||
:left (position-left control)
|
||||
:width (client-width control)
|
||||
:height (client-height control)))))))))
|
||||
(:name "size"
|
||||
:prop "size")
|
||||
(:name "place holder"
|
||||
:prop "placeholder")
|
||||
(:name "default value"
|
||||
:prop "defaultValue")
|
||||
(:name "image url"
|
||||
:prop "src")
|
||||
(:name "image alt"
|
||||
:prop "alt")
|
||||
(:name "checked"
|
||||
:get ,(lambda (control)
|
||||
(property control "checked"))
|
||||
:set ,(lambda (control obj)
|
||||
(if (equalp (text obj) "true")
|
||||
(setf (checkedp control) t)
|
||||
(setf (checkedp control) nil))
|
||||
(property control "required")))
|
||||
(:name "read only"
|
||||
:get ,(lambda (control)
|
||||
(property control "readonly"))
|
||||
:set ,(lambda (control obj)
|
||||
(if (equalp (text obj) "true")
|
||||
(setf (read-only-p control) t)
|
||||
(setf (read-only-p control) nil))
|
||||
(property control "readonly")))
|
||||
(:name "disabled"
|
||||
:get ,(lambda (control)
|
||||
(property control "disabled"))
|
||||
:set ,(lambda (control obj)
|
||||
(if (equalp (text obj) "true")
|
||||
(setf (disabledp control) t)
|
||||
(setf (disabledp control) nil))
|
||||
(property control "disabled")))
|
||||
(:name "required"
|
||||
:get ,(lambda (control)
|
||||
(property control "required"))
|
||||
:set ,(lambda (control obj)
|
||||
(if (equalp (text obj) "true")
|
||||
(setf (requiredp control) t)
|
||||
(setf (requiredp control) nil))
|
||||
(property control "required")))
|
||||
(:name "pattern"
|
||||
:prop "pattern")
|
||||
(:name "minimum"
|
||||
:prop "min")
|
||||
(:name "maximum"
|
||||
:prop "max")
|
||||
(:name "element step"
|
||||
:prop "step")
|
||||
(:name "minimum length"
|
||||
:prop "minlength")
|
||||
(:name "maximum length"
|
||||
:prop "maxlength")
|
||||
(:name "multiple"
|
||||
:get ,(lambda (control)
|
||||
(property control "multiple"))
|
||||
:set ,(lambda (control obj)
|
||||
(if (equalp (text obj) "true")
|
||||
(setf (multiplep control) t)
|
||||
(setf (multiplep control) nil))
|
||||
(property control "multiple")))
|
||||
(:name "files accepted"
|
||||
:prop "accept")))
|
||||
|
||||
(defparameter *props-colors*
|
||||
`((:name "color"
|
||||
|
|
@ -123,6 +167,26 @@
|
|||
(defparameter *props-form-element*
|
||||
`(,@*props-location*
|
||||
,@*props-wh*
|
||||
(:name "type"
|
||||
:setup ,(lambda (control td1 td2)
|
||||
(declare (ignore td1))
|
||||
(let ((dd (create-select td2))
|
||||
(v (string-downcase (attribute control "type"))))
|
||||
(add-select-options dd `(,v
|
||||
"button" "checkbox" "color" "date"
|
||||
"datetime" "datetime-local" "email"
|
||||
"image" "file" "hidden" "image"
|
||||
"month" "number" "password" "radio"
|
||||
"range" "reset" "search" "submit"
|
||||
"tel" "text" "time" "url" "week"))
|
||||
(set-on-change dd (lambda (obj)
|
||||
(declare (ignore obj))
|
||||
(setf (attribute control "type") (value dd))
|
||||
(set-geometry (get-placer control)
|
||||
:top (position-top control)
|
||||
:left (position-left control)
|
||||
:width (client-width control)
|
||||
:height (client-height control)))))))
|
||||
,@*props-value*
|
||||
,@*props-colors*))
|
||||
|
||||
|
|
@ -155,6 +219,8 @@
|
|||
:create-type :base
|
||||
:properties ((:name "method"
|
||||
:attr "method")
|
||||
(:name "encoding"
|
||||
:prop "encoding")
|
||||
(:name "from element count"
|
||||
:get ,(lambda (control) (form-element-count control)))))
|
||||
`(:name "input"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue