why would the parent model access that model.
Do it the other way around, let the dropdownchoice model access the parent model.
(by using a PropertyModel: new PropertyModel("dropdown1property" , parentModel))
or use one of the more sophesticated CompoundModels.

The dropdown1property is a property that the parentModel has where the selected object of the choice is kept.

johan



On 10/13/05, Andrew Berman <[EMAIL PROTECTED]> wrote:
If each dropdownchoice has its own model, how can the
parent form access it?

--- Johan Compagner <[EMAIL PROTECTED]> wrote:

> one dropdownchoice has its own model or a
> property/compound model of a
> parent model (which ever parent it maybe ,
> form/page)
> But the end result of that dropdownchoice must be On
> object that is of the
> same type of the objects that are in choices (the
> list of all objects that
> you can choose)
> Because a dropdown is a single select it handles
> only one selection so the
> model object is that selection.
>
> I don't know how the bigger picture looks like but
> you can have a larger
> object that could hold a selected object from every
> dropdownchoice you have.
>
> That can't be a list. Because if the list contains 3
> items which of the tree
> should be selected?
>
> johan
>
>
> On 10/13/05, Andrew Berman <[EMAIL PROTECTED]>
> wrote:
> >
> > 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
> > > > > > > > |
>
=== 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

Reply via email to