Adding initial value to textarea-input
This commit is contained in:
parent
13ff06aee5
commit
fa77770eac
|
@ -217,6 +217,9 @@
|
|||
(test-equal? "textarea-input"
|
||||
(test-display (textarea-input #:cols 80))
|
||||
'((textarea ([name "input_0"] [cols "80"]) "")))
|
||||
(test-equal? "textarea-input"
|
||||
(test-display (textarea-input #:value #"starting text" #:cols 80))
|
||||
'((textarea ([name "input_0"] [cols "80"]) "starting text")))
|
||||
(test-equal? "textarea-input"
|
||||
(test-display (textarea-input #:cols 80 #:rows 70))
|
||||
'((textarea ([name "input_0"] [rows "70"] [cols "80"]) "")))
|
||||
|
|
|
@ -223,6 +223,7 @@
|
|||
#:display display)))
|
||||
|
||||
(define (textarea-input
|
||||
#:value [value #f]
|
||||
#:attributes [attrs empty]
|
||||
#:rows [rows #f]
|
||||
#:cols [cols #f])
|
||||
|
@ -235,7 +236,9 @@
|
|||
(list (and rows (list 'rows (number->string rows)))
|
||||
(and cols (list 'cols (number->string cols)))))
|
||||
attrs))
|
||||
""))))
|
||||
(if value
|
||||
(bytes->string/utf-8 value)
|
||||
"")))))
|
||||
|
||||
(provide/contract
|
||||
[text-input (()
|
||||
|
@ -311,6 +314,7 @@
|
|||
[textarea-input (()
|
||||
(#:attributes
|
||||
(listof (list/c symbol? string?))
|
||||
#:value (or/c false/c bytes?)
|
||||
#:rows number?
|
||||
#:cols number?)
|
||||
. ->* .
|
||||
|
|
|
@ -304,7 +304,8 @@ These @tech{formlet}s are the main combinators for form input.
|
|||
This @tech{formlet} renders using an INPUT element with the PASSWORD type and the attributes given in the arguments.
|
||||
}
|
||||
|
||||
@defproc[(textarea-input [#:rows rows (or/c false/c number?) #f]
|
||||
@defproc[(textarea-input [#:value value (or/c false/c bytes?) #f]
|
||||
[#:rows rows (or/c false/c number?) #f]
|
||||
[#:cols cols (or/c false/c number?) #f]
|
||||
[#:attributes attrs (listof (list/c symbol? string?)) empty])
|
||||
(formlet/c (or/c false/c binding?))]{
|
||||
|
|
Loading…
Reference in New Issue
Block a user