Remove checkbox-bug

This commit is contained in:
interp 2002-12-07 22:27:02 +00:00
parent 4606552c2b
commit d705974612
1 changed files with 23 additions and 5 deletions

View File

@ -33,8 +33,14 @@
(if bad-query+value (if bad-query+value
(get-results queries title (get-results queries title
(ask (car bad-query+value) 'bad-input-text) (ask (car bad-query+value) 'bad-input-text)
(map cdr queries+values)) (map (lambda (query+value)
(map cdr queries+values))))) (let ((value (cdr query+value)))
(and value
(value-value value))))
queries+values))
(map (lambda (query+value)
(value-value (cdr query+value)))
queries+values)))))
(define (generate-simple-servlet-page new-url update-text title queries defaults) (define (generate-simple-servlet-page new-url update-text title queries defaults)
`(html `(html
@ -82,6 +88,11 @@
; (input-field query-input-field) ; (input-field query-input-field)
; (insist query-insist)) ; (insist query-insist))
(define-record-type value :value
(make-value value)
value?
(value value-value))
(define (standard-query text input-field insist) (define (standard-query text input-field insist)
(lambda (message) (lambda (message)
(case message (case message
@ -93,7 +104,12 @@
`(tr (td ,text) (td ,input-field)))) `(tr (td ,text) (td ,input-field))))
((value) ((value)
(lambda (self bindings) (lambda (self bindings)
(input-field-value input-field bindings))) ;; Return #f, if getting value failed, otherwise a value
;; object containing the value. This lets the checkbox field
;; to return #f as a valid value.
(with-fatal-error-handler
(lambda (c m) #f)
(make-value (raw-input-field-value input-field bindings)))))
((bad-input-text) ((bad-input-text)
(lambda (self) (lambda (self)
(format #f "~a to the question: ~a" insist text))) (format #f "~a to the question: ~a" insist text)))
@ -115,7 +131,9 @@
(case message (case message
((value) ((value)
(lambda (self bindings) (lambda (self bindings)
(if (input-field-binding input-field bindings) #t #f))) (if (input-field-binding input-field bindings)
(make-value #t)
(make-value #f))))
(else (else
(get-method standard message)))))) (get-method standard message))))))
@ -161,7 +179,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; OOP ;;; OOP
;;; from Mike Sperber ;;; from Mike Sperber (lecture winter term 1999/2000)
;; Objects are procedures returning methods ;; Objects are procedures returning methods
(define get-method (define get-method