Adding ListMultipleChoice as Custom Field

  • vedbharathi ved

    vedbharathi ved - 2011-02-03

    I trying to add ListMultipleChoice as Custom Field.  I created the field as String in the Items and History table so that data can be stored as comma separated string  .  I am having problem when I am trying to edit the item. I am getting error:-
    2011-02-02 17:51:06,100  ERROR  - Model object for a ListMultipleChoice must be a Collection (found class java.lang.String)
    org.apache.wicket.WicketRuntimeException: Model object for a ListMultipleChoice must be a Collection (found class java.lang.String)
    at org.apache.wicket.markup.html.form.ListMultipleChoice.getModelValue(
    at org.apache.wicket.markup.html.form.FormComponent.getValue(
    at org.apache.wicket.markup.html.form.AbstractChoice.onComponentTagBody(
    at org.apache.wicket.Component.renderComponent(
    at org.apache.wicket.MarkupContainer.onRender(
    at org.apache.wicket.Component.render(
    at org.apache.wicket.MarkupContainer.renderNext(
    at org.apache.wicket.MarkupContainer.renderComponentTagBody(
    at org.apache.wicket.MarkupContainer.onComponentTagBody(
    at org.apache.wicket.Component.renderComponent(

     else if (field.getName().getType() == 10) { 
                        Fragment f = new Fragment("field", "multiChoice");
                        final Map<String, String> options = field.getOptions();                                
                        List<String> keys = new ArrayList(options.keySet());  // bound value
                        ListMultipleChoice choice = new ListMultipleChoice("field",new PropertyModel(model, field.getName().getText()),new ArrayList(options.values()) );
                        /* new IChoiceRenderer() {
                             public Object getDisplayValue(Object o) {                          
                                 return options.get(o);
                             public String getIdValue(Object o, int i) {
                                 return o.toString();
                         choice.setLabel(new Model(field.getLabel()));                        
                         if (!field.isOptional()) {
                         WebMarkupContainer border = new WebMarkupContainer("border");
                         border.add(new ErrorHighlighter(choice));
                         border.add(model.bind(choice, field.getName().getText()));                    
                }  [/code]  
    Above code is in
    I am very new to Wicket . I need help fixing the problem .  Please help . I am confused with Model and ChoiceRenderer.  How should i fix this problem ?
    Please Please help me as soon as possible.
    Thanks so much
  • vedbharathi ved

    vedbharathi ved - 2011-02-07

    Never Mind . I got it working.

  • Ashish Srivastava

    Hi Ved,
    Can you please share the version of JTrac with option to add checkbox?

    Thanks in anticipation.

    Ashish Srivastava

  • vedbharathi ved

    vedbharathi ved - 2012-07-19

    Sorry i didnot see this message .. Do you still need this ? let me know i will post it here. thanks


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks