I have a template used for creating or revising an entity, which is called a "template". Users are given a list of options with multiple selections allowed. This is presented as a series of checkboxes. That works just fine when creating a new entity, but I am having trouble when revising an existing template. How do I add a "checked" attribute to some of the checkboxes? I'm not finding any documentation or examples for this.
I tried a couple things. First, I tried setting the checked attribute as follows:
Code:
UISelectChoice option_checkbox = UISelectChoice.make(option_row, "option-checkbox", option_list.getFullID(), option_ids.size());
if(entityPrefixes.contains(key))
{
option_checkbox.decorate(new UIFreeAttributeDecorator("checked", "checked"));
}
That didn't work. Next I tried adding two elements to the template:
Code:
<p rsf:id="option-row:">
<input type="checkbox" rsf:id="option-checkbox" id="option2"/>
<input type="checkbox" rsf:id="option-checkbox-checked" id="option2" checked="checked"/>
<label rsf:id="option-label" for="option2">options</label>
</p>
The producer would create an element with rsf:id of "option-checkbox" or "option-checkbox-checked" depending on whether entityPrefixes.contains(key). That created the appropriate elements, except the checked attributes were removed from the "option-checkbox-checked" tags.
I don't think I've seen an example in which checkboxes must be set checked or unchecked by the producer. Is there one?
Thanks. Jim.