开发者

Can not make rendering of html <select><option value="id".... with select-input formlet

I trying to use select-input formlet to render an

<开发者_JS百科SELECT ...><OPTION value="1">item1</OPTION><OPTION value="2">item2</OPTION></SELECT>

according to a documentation select-input expects 1 obligatory argument which is of type sequence? when i try to give an

(in-hash (make-hash (list (cons 1 "Item1") (cons 2 "Item2"))))

as such argument it throws exception:

context expected 1 value, received 2 values: 1 "Item1"

it is ok when i use list of "Item1" "Item2" How can i implement rendering of selection with values?


select-input will pick the values for you and guarantee that the right thing comes out. So

((select-input (list "Item1" "Item2")) . => . ans)

will return "Item1" or "Item2" into ans. It will pick the HTML "value" behind the scenes.

If you actually want 1 and 2 to return you could do:

((select-input (list 1 2)
               #:display (lambda (n) (format "Item~a" n)))
 . => . ans)

Now ans will have 1 or 2 but it will be displayed as Item1 or Item2

Jay

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜