Just to update....I read in another forum thread that using LoadableDetachabeModels is not the desired model type for mutliple page forms (wizards). I guess compoundproperty model is the correct approach.
tdelesio wrote: > > Hi, > > I have a couple of forms which "share" the same model. On the first page > I create the model and pass it to the rest of the pages. On each page a > little more information is stored in the model. At the end of the process > I want to write it to a database. Currently I'm trying to use > DetachableModels to do this. On the first page I create the model like: > > final IModel leagueModel = new CompoundPropertyModel(new > LoadableDetachableModel() > { > > @Override > protected Object load() > { > League league = new League(); > league.setAdmin(getPlayer()); > return league; > } > > }); > > This model is passed into the constructor of my form on the first page. > The form adds some info to the model and then passes it to the second > page. > > Form form = new Form("step1Form", leagueModel) > { > > @Override > protected void onSubmit() { > setResponsePage(new > CreateLeagueStep2Page(leagueModel)); > } > > }; > DropDownChoice leagueTypesDD = new DropDownChoice("leagueType", leagues, > new ChoiceRenderer("leagueTypeDisplay", "typeOfLeague")); > form.add(leagueTypesDD); > form.add(new Button("submit")); > > add(form); > > In the page constructor of the second page the model is correct. All the > data that was set on the first page is there. But, when I try and submit > the form on the second page the value set from the first are nulled out. > I assume this is because the load method is re-called and a new instance > of League is created. I know I can achieve the desired result by passing > an object (instead of the model) from page to page. Is it better to pass > a model from page to page or pass the object itself? If I am supposed to > use the DetachableModel approach how do I "persist" the model's state from > page to page? Thanks for the help. > > Tim > -- View this message in context: http://www.nabble.com/Passing-LoadableDetachableModels-tp19068126p19069915.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]