Amrita and checkboxes

How does one control whether or not a checkbox is “checked” using amrita? I’m familiar with using the a(:attr => value) form for modifying an attribute WITHIN a tag, but this attribute is either present or absent, it doesn’t have a value as such.

If I leave out the symbol, the entire tag is eliminated, not just the attribute within it.

Below, the “1” form is printed with “checked=on” as expected; the “2” form prints nothing; the entire text from to is eliminated, when all I want is the “checked” attribute WITHIN the <form…> tag to go away, not the whole thing.

Thoughts welcome.

require 'amrita/template’
include Amrita

t = TemplateText.new <<-html

html

data = {
:form => a(:action => ‘myform.cgi’, :checked => “on”)
}

puts "1"
t.expand(STDOUT, data)

puts "2"
data = {
:form => a(:action => ‘myform.cgi’)
}

Michael campbell wrote:

How does one control whether or not a checkbox is "checked" using amrita?

I'm an idiot, apologies for the earlier message. I had failed in my test script to do the second t.expand() call...

Apologies again to all.

This works as expected:

···

###
require 'amrita/template'
include Amrita

t = TemplateText.new <<-html
<input id=form type="checkbox" name="search" checked>
html

data = {
:form => a(:checked => "ON")
}

puts "1"
t.expand(STDOUT, data) # prints <input type="checkbox" name="search" checked="ON" action="myform.cgi">

puts "2"
data = {
:form => a(:checked=>nil)
}
t.expand(STDOUT, data)

# prints <input type="checkbox" name="search" action="myform.cgi">