Parameterize over error message in make-simple-default-setter
This commit is contained in:
parent
15f07f8d4a
commit
2268fe3231
|
@ -39,13 +39,13 @@
|
|||
,(field-attributes-default attributes)
|
||||
,(field-attributes-others attributes))))))
|
||||
|
||||
(define (make-simple-default-setter default-pred?)
|
||||
(define (make-simple-default-setter default-pred? error-msg-types)
|
||||
(lambda (input-field value)
|
||||
(if (default-pred? value)
|
||||
(set-field-attributes-default!
|
||||
(input-field-attributes input-field)
|
||||
`(value ,value))
|
||||
(error "Default value must be a number or a string or a symbol."
|
||||
(error (format #f "Default value must be ~a." error-msg-types)
|
||||
value))
|
||||
(touch-input-field! input-field)))
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
|||
(define simple-default? string-or-symbol?)
|
||||
|
||||
(define set-simple-field-default!
|
||||
(make-simple-default-setter simple-default?))
|
||||
(make-simple-default-setter simple-default? "a string or a symbol"))
|
||||
|
||||
(define (second-arg first second) second)
|
||||
|
||||
|
@ -76,7 +76,8 @@
|
|||
(simple-field-maker "text" "number"
|
||||
number-field-default? number-field-transformer))
|
||||
(define set-number-field-value!
|
||||
(make-simple-default-setter number-field-default?))
|
||||
(make-simple-default-setter number-field-default?
|
||||
"a number a string or a symbol"))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; hidden input-field
|
||||
|
|
Loading…
Reference in New Issue