[racket] xexpr to mark a radio button 'checked'

From: John Clements (clements at brinckerhoff.org)
Date: Thu Apr 28 02:51:33 EDT 2011

On Apr 27, 2011, at 3:11 PM, J G Cho wrote:

> I am trying to print:
> <div><input type="radio" name="n-4-answer" value="2" checked>the egg</div>
> The closest I can come up is:
> <div><input type="radio" name="n-4-answer"
> value="2">checked</input>the egg</div>
> Valid XML but not quite what a browser wants.
> Is this (the first line) possible with xexpr?

It looks like the browser is actually just checking for the existence of a "checked" attribute.  So, for instance, I just tried this in my browser:

 <div><input type="radio" name="n-4-answer" value="2" checked="">the egg</div>

... and I got the desired effect.  So it looks like you can write this as the xexpr

'(div (input ((type "radio") (name "n-4-answer") (value "2") (checked ""))) "the egg")

... though I haven't tried it out as an xexpr.

John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20110427/2f0cddb6/attachment.p7s>

Posted on the users mailing list.