[Logo] RSF Discussions Forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Getting checkboxes checked with UISelectChoice  XML
Forum Index -> RSF Help and Problems
Author Message
jimeng
Request-scope Wrangler

Joined: 11/07/2006 17:41:40
Messages: 84
Offline

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.
antranig
Request-scope Wrangler

Joined: 03/04/2006 13:29:55
Messages: 643
Offline

Hi there Jim. You should not attempt to take control of the checkbox markup directly, but simply supply the correct initial value to the UISelect control to which they are bound - that is, the "value" of the control should hold a String[] which corresponds to the set of options which are selected.
 
Forum Index -> RSF Help and Problems
Message Quick Reply
Go to:   
Powered by JForum 2.1.6 © JForum Team