Hello Rodrigo,

sure i know that the "null" has to be replaced by a model. But my question was
targeted to the object behind the "dropdown selected option model".

Let me create a more simple example:

<code>
MyComponent.java
----- in constructor -----
IModel<ReplyOptionsCollectingModel> formModel = Model.<ReplyOptionsCollectingModel> of(new ReplyOptionsCollectingModel())
Form<?> form ...;
form.add(new DropDownChoice("replysForQuestion1", new PropertyModel<ReplyOption>(formModel, "answerForQuestion1"), replyOptionsForQuestion1())); form.add(new DropDownChoice("replysForQuestion2", new PropertyModel<ReplyOption>(formModel, "answerForQuestion2"), replyOptionsForQuestion2()));

ReplyOptionsCollectingModel.java
public class ReplyOptionsCollectingModel implements Serializable {
  private ReplyOption answerForQuestion1;
  private ReplyOption answerForQuestion2;

  // ... getter and setter
}
</code>

But because i don't know the count of questions i have to use a repeating view.

<code>
MyComponent.java
----- in constructor -----
IModel<ReplyOptionsCollectingModel> formModel = Model.<ReplyOptionsCollectingModel> of(new ReplyOptionsCollectingModel())
Form<?> form ...;
ListView<Question> questions = new ListView(...) {
   protected void populateItem(ListItem<Question> item) {
item.add(new DropDownChoice("replysForQuestion", new PropertyModel<ReplyOption>(formModel, I_dont_know_what_to_add_here), replyOptionsFor(item.getModelObject())));
   }
}
form.add(answers);

ReplyOptionsCollectingModel.java
public class ReplyOptionsCollectingModel implements Serializable {
  private Map<Question, ReplyOption> answerForQuestions;
}
</code>

Or do you mean that CompoundPropertyModel has more "features"
handling the indexed-property stuff?

Thanks for your support
Per

Am 21.04.2013 00:31, schrieb Rodrigo Heffner:
Have you tried using CompoundPropertyModels? In that way you could bind a
property to the dropdown, instead of using "null"



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to