Announcement Announcement Module
Collapse
No announcement yet.
Strategy for binding reference data in radio button groups to my model Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Strategy for binding reference data in radio button groups to my model

    I have a complex form with many select boxes and radio buttons and all is working except for a fundamental problem with radio button groups.

    Groups of radio boxes are rendered based on a deeply nested set of reference data:

    Code:
    public class DesignItem {
    	
    	private List<Select> select = ListUtils.lazyList(new ArrayList<Select>(),FactoryUtils.instantiateFactory(Select.class));
    	
    	//other properties
    }
    
    public class Select {
    
    	private List<Option> options = ListUtils.lazyList(new ArrayList<Option>(),FactoryUtils.instantiateFactory(Option.class));
    
    	//other properties
    }
    
    public class Option {
    	
    	private String label;	
    	private String id;
    }
    I need radio button groups to be grouped on the designItem.select property, so I'm forced to bind my command class to a deeply nested structure too, since the name property of the HTML input field has to be unique for each radio button group.

    Now I have a problem binding the user selected radio options, as I have no idea how to manually bind a path like select[0].options - can I do this with custom property editors? Note that I can easily bind this to a flat object structure, by registering a custom property editor to the flattened structure - my problem is because I'm forced to use use a deeper structure because of the button group.


    This seems like such a simple thing, yet I've been stuck on it for ages. Is there a simple solution?
Working...
X