form.add(new MyPanel()). Form is a component just like everything else.
-- Jeremy Thomerson http://www.wickettraining.com On Tue, Apr 27, 2010 at 11:17 AM, Steven Haines <[email protected]> wrote: > Okay, I'm working on it, here is a followup question: how do I add a panel > to a form? > > Here's where I'm stuck. Here is my HTML with my panels embedded inside my > form: > > <form wicket:id="myForm" id="myForm"> > <div id="panelOne" wicket:id="panelOne">Panel One</div> > <div id="panelTwo" wicket:id="panelTwo">Panel Two</div> > <div id="panelThree" wicket:id="panelThree">Panel > Three</div> > <div id="panelFour" wicket:id="panelFour">Panel > Four</div> > </form> > > But how do I build the object hierarchy? The following fails because > obviously the hierarchy is wrong (the panels are children of the form), but > the Form class does not have an add() method to accept Panels.. > > final MyForm myForm = new MyForm(); > final Form<MyForm> form = new Form<MyForm>( "myForm", new > CompoundPropertyModel<MyForm>( myForm ) ); > add( new PanelOne( "panelOne" ), form ); > add( new PanelTwo( "panelTwo" ), form ); > add( new PanelThree( "panelThree" ), form ); > add( new PanelFour( "panelFour" ), form ); > add( form ); > > Should I make all of the panels implement IFormValidator so that I can make > them match the page hierarchy? Or do you have any other more elegant > suggestions? > > Thanks > Steve > > > > ----- Original Message ---- > From: Martin Makundi <[email protected]> > To: [email protected]; Steven Haines <[email protected]> > Sent: Tue, April 27, 2010 10:18:13 AM > Subject: Re: Forms across multiple panels > > Hi! > > Yes.. you could have: > > <form> > <panel 1/> > <panel 2/> > <submit-button/> > </form> > > ** > Martin > > 2010/4/27 Steven Haines <[email protected]>: > > Sorry, yes, I have a "MasterPage" HTML and Java combination that hosts > the divs, so something like this: > > > > Java: > > public class MasterPage extends WebPage ... > > > > MyObject myobject = new MyObject(); > > add( new Panel1( "panel1", myobject ) ); > > add( new Pane2( "panel2", myobject ) ); > > > > ... > > > > HTML: > > ... > > <div wicket:id="panel1"></div> > > <div wicket:id="panel2"></div> > > ... > > > > So conceivably I could create a form object on the MasterPage... > > > > > > > > > > ----- Original Message ---- > > From: Martin Makundi <[email protected]> > > To: [email protected]; Steven Haines <[email protected]> > > Sent: Tue, April 27, 2010 10:08:06 AM > > Subject: Re: Forms across multiple panels > > > > Panels are on same web-page? > > > > ** > > Martin > > > > 2010/4/27 Steven Haines <[email protected]>: > >> Hi, > >> > >> The application I'm building is composed of several panels, each > contained in its own <div>. The panels are logical groupings of data, handle > different Ajax requests, and so forth. > >> > >> My challenge is that when a user completes the process by entering data > into all of the panels, I want to submit the form data from all of the > panels into a single form submit. Or written a different way, I do not want > to have to submit each panel individually, I want a single submission. > >> > >> What is the best way to do this? > >> > >> Thanks > >> Steve > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
