On 10/13/05, Johan Compagner <[EMAIL PROTECTED]
> wrote:
ok so what sits exactly in that List options?
Are those just POJO's that do have a getId() ??
and also a getResponse().getText() ?
can you for example do this:
public class DropDownPanel extends Panel {
public DropDownPanel(String id, IModel model, List options, IChoiceRenderer choiceRenderer) {
super(id);
YoureObject object = (YoureObject)options.get(0);
System.out.println(object.getId());
System.out.println(object.getResponse().getText());
add(new DropDownChoice("dropdown", model, options, choiceRenderer));
}
On 10/13/05, Andrew Berman < [EMAIL PROTECTED]> wrote:Oh, sorry. I attached the relevant code. I'm alsopublic QuestionsForm(String id, Long categoryId) {
having an issue trying to get the form model filled
in. Maybe my code can shed some light on what I'm
doing wrong....
Thanks,
Andrew
--- Johan Compagner < [EMAIL PROTECTED]> wrote:
> No that was not what i meant.
>
> I just want to know what type of objects/list you
> set in the model
> and how youre choicerenderer looks like
>
> so what does the code looks like that makes a
> datachoice and its
> choicerenderer?
>
> johan
>
>
> On 10/13/05, Andrew Berman < [EMAIL PROTECTED]>
> wrote:
> >
> > Here's the deal. I am creating a dynamic form,
> > meaning that the HTML elements are determined from
> the
> > database. This allows me to create a survey with
> > different questions and responses. As a result,
> the
> > survey can have multiple drop downs or groups of
> > checkboxes, etc. However, the one common thing
> > amongst all of them is that the id in their value
> > attributes all refer to the same type of object.
> So I
> > basically just want to gather up the ids in one
> form
> > model. It seems that Wicket, as evidenced in my
> other
> > forms, actually puts in the object that the id is
> > referring to instead of the actual id, which is
> fine.
> > My objects are set up like so:
> >
> > FormPanel
> > |
> > -- Form
> > |
> > --DropDownPanel
> > |
> > -- DropDownChoice
> > |
> > -- ListMultipleChoicePanel
> > |
> > -- ListMultipleChoice
> >
> > So, based on the response type from the database
> it
> > adds the proper panel and the panel, in turn, adds
> the
> > proper form element. I'm just struggling trying to
> > get the form's model filled in properly since the
> > actual form element is nested two layers deeper.
> Any
> > suggestions?
> >
> > Thanks for your help!
> >
> > Andrew
> >
> >
> > --- Johan Compagner <[EMAIL PROTECTED]> wrote:
> >
> > > how did you exactly configure everything?
> > > it looks like it tries to get an id from an
> array so
> > > it looks like you
> > > have an array in your list/model
> > >
> > > On 10/12/05, Andrew Berman < [EMAIL PROTECTED]>
> > > wrote:
> > > > Hello,
> > > >
> > > > I'm having a problem trying to get a dropdown
> > > to
> > > > work in a form. I have a simple model that
> just
> > > > includes a Set. All I want to do is select
> > > multiple
> > > > items in the dropdown and have it fill in the
> set
> > > with
> > > > ids. I add a new DropDownChoice and pass it a
> > > list of
> > > > my own domain objects and use a ChoiceRenderer
> to
> > > pull
> > > > out a specific property of that object for the
> id
> > > and
> > > > displayValue. When it tries to render the
> > > > DropDownChoice I get an error that says:
> > > >
> > > > wicket.WicketRuntimeException: Error getting
> id
> > > value
> > > > of: [] for property: id
> > > >
> > > > So, basically, this is telling me that the
> > > > ChoiceRenderer is looking for the id property
> in
> > > my
> > > > model, which is not how I thought things
> worked.
> > > > Isn't ChoiceRenderer for pulling the id and
> > > display
> > > > value out of the list I pass it? Can anyone
> > > explain
> > > > to me what I'm doing wrong?
> > > >
> > > > Thanks for any help,
> > > >
> > > > Andrew
> > > >
> > > >
> > > >
> > >
> >
>
-------------------------------------------------------
> > > > This SF.Net email is sponsored by:
> > > > Power Architecture Resource Center: Free
> content,
> > > downloads, discussions,
> > > > and more.
> > > http://solutions.newsforge.com/ibmarch.tmpl
> > > >
> _______________________________________________
> > > > Wicket-user mailing list
> > > > [email protected]
> > > >
> > >
> >
>
https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >
> > >
> > >
> > >
> >
>
-------------------------------------------------------
> > > This SF.Net email is sponsored by:
> > > Power Architecture Resource Center: Free
> content,
> > > downloads, discussions,
> > > and more.
> > > http://solutions.newsforge.com/ibmarch.tmpl
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > >
> >
>
https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
> >
> >
> >
>
-------------------------------------------------------
> > This SF.Net email is sponsored by:
> > Power Architecture Resource Center: Free content,
> downloads, discussions,
> > and more.
> http://solutions.newsforge.com/ibmarch.tmpl
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> >
>
https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
super(id, new Model(new ArrayList()));
List<CategoryQuestion> categoryQuestions = ServiceLookup
.getCategoryService().getCategoryQuestions(categoryId);
add(new ListView("categoryQuestions", categoryQuestions) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem item) {
CategoryQuestion cq = (CategoryQuestion) item
.getModelObject();
ResponseType type = cq.getResponseType();
List<CategoryQuestionResponse> cqResponses = new ArrayList<CategoryQuestionResponse>(
cq.getValidResponses());
item.add(new Label("questionLabel", cq.getQuestion()
.getText()));
IModel model = getParent().getParent().getModel();
if (type.equals(ResponseType.DROPDOWN)) {
item.add(new DropDownPanel("formPanel", model, cqResponses,
new ChoiceRenderer("response.text", "id")));
}
}
});
}
public class DropDownPanel extends Panel {
public DropDownPanel(String id, IModel model, List options, IChoiceRenderer choiceRenderer) {
super(id);
add(new DropDownChoice("dropdown", model, options, choiceRenderer));
}
public DropDownPanel(String id, IModel model, List options) {
this(id, model, options, null);
}
}
