[racket] textarea-input keys

From: Shogo Yamazaki (moquo2.718 at gmail.com)
Date: Mon Jun 27 12:06:45 EDT 2011

Hi.
I'm now reading article about using formlets in
'Continue: Web Applications in Racket' and trying to use formlets.
It's very exciting!

There is a #:attributes key with text-input, therefore
I can use HTML5 attributes with text-boxes.
On the other hand, textarea-input has only #:rows and #:cols keys,
so I defined my-textarea-input below.

I wonder why it doesn't support #:attributes by default.
Or is there any other smart way?

Thanks.

Shogo Yamazaki
moquo2.718 at gmail.com


(define (my-textarea-input
         #:rows [rows #f]
         #:cols [cols #f]
         #:attributes [attrs empty]
         #:initial-value [iniv ""])
  (make-input
   (lambda (n)
     (list 'textarea
           (list* (list 'name n)
                  (append
                   (filter list?
                           (list (and rows (list 'rows (number->string rows)))
                                 (and cols (list 'cols (number->string cols)))))
                   attrs))
           iniv))))


Posted on the users mailing list.