Right, but the problem is that there is the potential
for multiple dropdowns on the same page and I want all
of them to update the form's model. I think I've done
everything wrong. I'm really confused with how the
model is being passed around.
Since I have the form include a panel which includes a
form component, how can I have that form component
(e.g. dropdown) update the form's model. I was able
to get the whole thing to not give me a RuntimeError
anymore only when each separate form component has its
own private model, but this does not help me, since I
have no way of accessing that model from the form's
onsubmit method.
The way I have it set up now is that the form has a
model of ArrayList. I thought the ArrayList would
fill with a list of CategoryQuestionResponse objects
that were selected on the page, which is not the case.
Instead it remains empty. So I guess the crux of my
problem is how to fill in the form's model and not
each component's private model.
Thanks again for your help, I really appreciate it.
--Andrew
--- Johan Compagner <[EMAIL PROTECTED]> wrote:
> wait i see it
> a dropdown is a single select!
> you have to use the ListMultipleChoice there you can
> set as model a list a
> dropdown only wants to have a single object.
>
>
>
> On 10/13/05, Johan Compagner <[EMAIL PROTECTED]>
> wrote:
> >
> > YoureObject is then the CategoryQuestionResponse
> (if i look at youre code)
> >
> > 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
> also
> > > > 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
>
=== message truncated ===
-------------------------------------------------------
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