You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steve Mactaggart <st...@whitesquaresoft.com> on 2010/03/22 01:35:29 UTC

Forms in a base class

Hi all,

Before I go to far trying to prove I have a bug, I thought i'd crowd
source an answer.

We have a lot of "Edit" pages that have a lot of simmilar structure,
and what I wanted to do is create a BaseEditPage that contains the
form, the save/cancel buttons, some layout stuff and a FeedbackPanel,
then extend it into UserEditPage that just adds the fields that are
editable.

I can get this working as long as I put all the HTML into the
UserEditPage.html file.

Lets make this simple.  Lets say that BaseEditPage extends
StandardPage, where StandardPage provides a standard header, footer
and so all we have to worry about in the BaseEditPage is the "content"
of the page.

My BaseEditPage html will look like:

<wicket:extend>
<form wicket:id="form">
  <div wicket:id="feedback"/>
  <wicket:child/>

  <input type="button" wicket:id="save"/>
  <input type="button" wicket:id="cancel"/>
</form>
</wicket:extend>

And the BaseEditPage.java is like:

public class BaseEditPage extends StandardPage {

Form form;
SubmitLink saveButton;
SubmitLink cancelButton;
FeedbackPanel feedbackPanel;

public BaseEditPage() {
   super();

   form = new Form("form");

   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
example simple.
   cancelButton = new SubmitLink("cancel");

   feedbackPanel = new FeedbackPanel("feedback");

   add(form);

   form.add(saveButton);
   form.add(cancelButton);
   form.add(feedbackPanel);
}
}

Now I create my UserEditPage

public UserEditPage extends BaseEditPage {

RequiredTextField username;

public UserEditPage() {
    username = new RequiredTextField<String>("username", new
Model("test-username"));

    add(username);
}

}

And create the HTML for the page like:
<wicket:extend>
  Username: <input type="text" wicket:id="username"/>
</wicket:extend>


When I run this simple example I get a messsage stating:
    Unable to find component with id 'username' in [MarkupContainer
[Component id = _extend4]].

My guess is this is an issue processing the sub class due to the fact
that the <form> tag is still open.

Is there any way to do this, or is this outside the scope of Wicket?

Cheers,
Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Forms in a base class

Posted by Steve Mactaggart <st...@gmail.com>.
Using the getForm().add(...) solves my problems and I have been able to get
really nice small and clean sub-classes that just have a few components
working in them.

The Feedback panel, save and cancel buttons along with the form and some
default formatting are supplied in the parent class, then each sub-class can
add its specific fields to edit by adding them to the parent form (via a
getForm()) method instead of the subclass page.

Works great.

On Tue, Mar 23, 2010 at 1:07 AM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:

> Martijn, they would still be in the form tag when rendered - see the
> placement of the wicket:child tag.
>
> However, I think Igor is right - the transparent resolver may not work on a
> form.  I haven't used it for that, so I couldn't tell you.
>
> What it really boils down to is that you need the subclasses to add their
> components to the form.  You can either do it as I described in the first
> post (getForm().add(...)).  Or you may come up with some other way.  Let us
> know how it goes.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Mon, Mar 22, 2010 at 5:12 AM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
>
> > I concur: the form fields need to be inside the <form> tag, otherwise
> > the browser will not send them to the server.
> >
> > Martijn
> >
> > On Mon, Mar 22, 2010 at 6:00 AM, Igor Vaynberg <ig...@gmail.com>
> > wrote:
> > > dont think that will work. it will work for rendering, but for
> > > processing components it wont work because they really need to be
> > > descendants of the form.
> > >
> > > -igor
> > >
> > > On Sun, Mar 21, 2010 at 7:08 PM, Jeremy Thomerson
> > > <je...@wickettraining.com> wrote:
> > >> Sorry, override isTransparentResolver.  The set method is only on
> > Border.
> > >>
> > >> --
> > >> Jeremy Thomerson
> > >> http://www.wickettraining.com
> > >>
> > >>
> > >>
> > >> On Sun, Mar 21, 2010 at 8:00 PM, Steve Mactaggart <
> > >> steve.mactaggart@gmail.com> wrote:
> > >>
> > >>> Excellent,
> > >>>
> > >>> My simple test now seems to work if I do a getForm().
> > >>> Although I really like the thought of setTransparentResolver(), but
> as
> > >>> with  Josh, I can't find it in 1.4.7..
> > >>>
> > >>> I also have this problem with a Border object, I'll have to look into
> > >>> seeing if I can  get around the same problem by doing a getBorder().
> > >>>
> > >>> Steve
> > >>>
> > >>> On Mon, Mar 22, 2010 at 11:40 AM, Jeremy Thomerson
> > >>> <je...@wickettraining.com> wrote:
> > >>> > you need to be adding the components to the form.  you're currently
> > >>> adding
> > >>> > them to the page itself.  the component hierarchy is thus broken.
>  on
> > >>> your
> > >>> > child page, either do getForm().add(foo) [you'll need to expose a
> > getForm
> > >>> > method that returns the form from the parent page] or else on your
> > parent
> > >>> > page (BaseEditPage), setTransparentResolver(true) on the form and
> add
> > the
> > >>> > form children to the page then.
> > >>> >
> > >>> > --
> > >>> > Jeremy Thomerson
> > >>> > http://www.wickettraining.com
> > >>> >
> > >>> >
> > >>> >
> > >>> > On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <
> > >>> steve@whitesquaresoft.com
> > >>> >> wrote:
> > >>> >
> > >>> >> Hi all,
> > >>> >>
> > >>> >> Before I go to far trying to prove I have a bug, I thought i'd
> crowd
> > >>> >> source an answer.
> > >>> >>
> > >>> >> We have a lot of "Edit" pages that have a lot of simmilar
> structure,
> > >>> >> and what I wanted to do is create a BaseEditPage that contains the
> > >>> >> form, the save/cancel buttons, some layout stuff and a
> > FeedbackPanel,
> > >>> >> then extend it into UserEditPage that just adds the fields that
> are
> > >>> >> editable.
> > >>> >>
> > >>> >> I can get this working as long as I put all the HTML into the
> > >>> >> UserEditPage.html file.
> > >>> >>
> > >>> >> Lets make this simple.  Lets say that BaseEditPage extends
> > >>> >> StandardPage, where StandardPage provides a standard header,
> footer
> > >>> >> and so all we have to worry about in the BaseEditPage is the
> > "content"
> > >>> >> of the page.
> > >>> >>
> > >>> >> My BaseEditPage html will look like:
> > >>> >>
> > >>> >> <wicket:extend>
> > >>> >> <form wicket:id="form">
> > >>> >>  <div wicket:id="feedback"/>
> > >>> >>  <wicket:child/>
> > >>> >>
> > >>> >>  <input type="button" wicket:id="save"/>
> > >>> >>  <input type="button" wicket:id="cancel"/>
> > >>> >> </form>
> > >>> >> </wicket:extend>
> > >>> >>
> > >>> >> And the BaseEditPage.java is like:
> > >>> >>
> > >>> >> public class BaseEditPage extends StandardPage {
> > >>> >>
> > >>> >> Form form;
> > >>> >> SubmitLink saveButton;
> > >>> >> SubmitLink cancelButton;
> > >>> >> FeedbackPanel feedbackPanel;
> > >>> >>
> > >>> >> public BaseEditPage() {
> > >>> >>   super();
> > >>> >>
> > >>> >>   form = new Form("form");
> > >>> >>
> > >>> >>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
> > >>> >> example simple.
> > >>> >>   cancelButton = new SubmitLink("cancel");
> > >>> >>
> > >>> >>   feedbackPanel = new FeedbackPanel("feedback");
> > >>> >>
> > >>> >>   add(form);
> > >>> >>
> > >>> >>   form.add(saveButton);
> > >>> >>   form.add(cancelButton);
> > >>> >>   form.add(feedbackPanel);
> > >>> >> }
> > >>> >> }
> > >>> >>
> > >>> >> Now I create my UserEditPage
> > >>> >>
> > >>> >> public UserEditPage extends BaseEditPage {
> > >>> >>
> > >>> >> RequiredTextField username;
> > >>> >>
> > >>> >> public UserEditPage() {
> > >>> >>    username = new RequiredTextField<String>("username", new
> > >>> >> Model("test-username"));
> > >>> >>
> > >>> >>    add(username);
> > >>> >> }
> > >>> >>
> > >>> >> }
> > >>> >>
> > >>> >> And create the HTML for the page like:
> > >>> >> <wicket:extend>
> > >>> >>  Username: <input type="text" wicket:id="username"/>
> > >>> >> </wicket:extend>
> > >>> >>
> > >>> >>
> > >>> >> When I run this simple example I get a messsage stating:
> > >>> >>    Unable to find component with id 'username' in [MarkupContainer
> > >>> >> [Component id = _extend4]].
> > >>> >>
> > >>> >> My guess is this is an issue processing the sub class due to the
> > fact
> > >>> >> that the <form> tag is still open.
> > >>> >>
> > >>> >> Is there any way to do this, or is this outside the scope of
> Wicket?
> > >>> >>
> > >>> >> Cheers,
> > >>> >> Steve
> > >>> >>
> > >>> >>
> > ---------------------------------------------------------------------
> > >>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > >>> >> For additional commands, e-mail: users-help@wicket.apache.org
> > >>> >>
> > >>> >>
> > >>> >
> > >>>
> > >>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > >>> For additional commands, e-mail: users-help@wicket.apache.org
> > >>>
> > >>>
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> >
> > --
> > Become a Wicket expert, learn from the best: http://wicketinaction.com
> > Apache Wicket 1.4 increases type safety for web applications
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

Re: Forms in a base class

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Martijn, they would still be in the form tag when rendered - see the
placement of the wicket:child tag.

However, I think Igor is right - the transparent resolver may not work on a
form.  I haven't used it for that, so I couldn't tell you.

What it really boils down to is that you need the subclasses to add their
components to the form.  You can either do it as I described in the first
post (getForm().add(...)).  Or you may come up with some other way.  Let us
know how it goes.

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, Mar 22, 2010 at 5:12 AM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> I concur: the form fields need to be inside the <form> tag, otherwise
> the browser will not send them to the server.
>
> Martijn
>
> On Mon, Mar 22, 2010 at 6:00 AM, Igor Vaynberg <ig...@gmail.com>
> wrote:
> > dont think that will work. it will work for rendering, but for
> > processing components it wont work because they really need to be
> > descendants of the form.
> >
> > -igor
> >
> > On Sun, Mar 21, 2010 at 7:08 PM, Jeremy Thomerson
> > <je...@wickettraining.com> wrote:
> >> Sorry, override isTransparentResolver.  The set method is only on
> Border.
> >>
> >> --
> >> Jeremy Thomerson
> >> http://www.wickettraining.com
> >>
> >>
> >>
> >> On Sun, Mar 21, 2010 at 8:00 PM, Steve Mactaggart <
> >> steve.mactaggart@gmail.com> wrote:
> >>
> >>> Excellent,
> >>>
> >>> My simple test now seems to work if I do a getForm().
> >>> Although I really like the thought of setTransparentResolver(), but as
> >>> with  Josh, I can't find it in 1.4.7..
> >>>
> >>> I also have this problem with a Border object, I'll have to look into
> >>> seeing if I can  get around the same problem by doing a getBorder().
> >>>
> >>> Steve
> >>>
> >>> On Mon, Mar 22, 2010 at 11:40 AM, Jeremy Thomerson
> >>> <je...@wickettraining.com> wrote:
> >>> > you need to be adding the components to the form.  you're currently
> >>> adding
> >>> > them to the page itself.  the component hierarchy is thus broken.  on
> >>> your
> >>> > child page, either do getForm().add(foo) [you'll need to expose a
> getForm
> >>> > method that returns the form from the parent page] or else on your
> parent
> >>> > page (BaseEditPage), setTransparentResolver(true) on the form and add
> the
> >>> > form children to the page then.
> >>> >
> >>> > --
> >>> > Jeremy Thomerson
> >>> > http://www.wickettraining.com
> >>> >
> >>> >
> >>> >
> >>> > On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <
> >>> steve@whitesquaresoft.com
> >>> >> wrote:
> >>> >
> >>> >> Hi all,
> >>> >>
> >>> >> Before I go to far trying to prove I have a bug, I thought i'd crowd
> >>> >> source an answer.
> >>> >>
> >>> >> We have a lot of "Edit" pages that have a lot of simmilar structure,
> >>> >> and what I wanted to do is create a BaseEditPage that contains the
> >>> >> form, the save/cancel buttons, some layout stuff and a
> FeedbackPanel,
> >>> >> then extend it into UserEditPage that just adds the fields that are
> >>> >> editable.
> >>> >>
> >>> >> I can get this working as long as I put all the HTML into the
> >>> >> UserEditPage.html file.
> >>> >>
> >>> >> Lets make this simple.  Lets say that BaseEditPage extends
> >>> >> StandardPage, where StandardPage provides a standard header, footer
> >>> >> and so all we have to worry about in the BaseEditPage is the
> "content"
> >>> >> of the page.
> >>> >>
> >>> >> My BaseEditPage html will look like:
> >>> >>
> >>> >> <wicket:extend>
> >>> >> <form wicket:id="form">
> >>> >>  <div wicket:id="feedback"/>
> >>> >>  <wicket:child/>
> >>> >>
> >>> >>  <input type="button" wicket:id="save"/>
> >>> >>  <input type="button" wicket:id="cancel"/>
> >>> >> </form>
> >>> >> </wicket:extend>
> >>> >>
> >>> >> And the BaseEditPage.java is like:
> >>> >>
> >>> >> public class BaseEditPage extends StandardPage {
> >>> >>
> >>> >> Form form;
> >>> >> SubmitLink saveButton;
> >>> >> SubmitLink cancelButton;
> >>> >> FeedbackPanel feedbackPanel;
> >>> >>
> >>> >> public BaseEditPage() {
> >>> >>   super();
> >>> >>
> >>> >>   form = new Form("form");
> >>> >>
> >>> >>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
> >>> >> example simple.
> >>> >>   cancelButton = new SubmitLink("cancel");
> >>> >>
> >>> >>   feedbackPanel = new FeedbackPanel("feedback");
> >>> >>
> >>> >>   add(form);
> >>> >>
> >>> >>   form.add(saveButton);
> >>> >>   form.add(cancelButton);
> >>> >>   form.add(feedbackPanel);
> >>> >> }
> >>> >> }
> >>> >>
> >>> >> Now I create my UserEditPage
> >>> >>
> >>> >> public UserEditPage extends BaseEditPage {
> >>> >>
> >>> >> RequiredTextField username;
> >>> >>
> >>> >> public UserEditPage() {
> >>> >>    username = new RequiredTextField<String>("username", new
> >>> >> Model("test-username"));
> >>> >>
> >>> >>    add(username);
> >>> >> }
> >>> >>
> >>> >> }
> >>> >>
> >>> >> And create the HTML for the page like:
> >>> >> <wicket:extend>
> >>> >>  Username: <input type="text" wicket:id="username"/>
> >>> >> </wicket:extend>
> >>> >>
> >>> >>
> >>> >> When I run this simple example I get a messsage stating:
> >>> >>    Unable to find component with id 'username' in [MarkupContainer
> >>> >> [Component id = _extend4]].
> >>> >>
> >>> >> My guess is this is an issue processing the sub class due to the
> fact
> >>> >> that the <form> tag is still open.
> >>> >>
> >>> >> Is there any way to do this, or is this outside the scope of Wicket?
> >>> >>
> >>> >> Cheers,
> >>> >> Steve
> >>> >>
> >>> >>
> ---------------------------------------------------------------------
> >>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>> >>
> >>> >>
> >>> >
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Forms in a base class

Posted by Martijn Dashorst <ma...@gmail.com>.
I concur: the form fields need to be inside the <form> tag, otherwise
the browser will not send them to the server.

Martijn

On Mon, Mar 22, 2010 at 6:00 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> dont think that will work. it will work for rendering, but for
> processing components it wont work because they really need to be
> descendants of the form.
>
> -igor
>
> On Sun, Mar 21, 2010 at 7:08 PM, Jeremy Thomerson
> <je...@wickettraining.com> wrote:
>> Sorry, override isTransparentResolver.  The set method is only on Border.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>> On Sun, Mar 21, 2010 at 8:00 PM, Steve Mactaggart <
>> steve.mactaggart@gmail.com> wrote:
>>
>>> Excellent,
>>>
>>> My simple test now seems to work if I do a getForm().
>>> Although I really like the thought of setTransparentResolver(), but as
>>> with  Josh, I can't find it in 1.4.7..
>>>
>>> I also have this problem with a Border object, I'll have to look into
>>> seeing if I can  get around the same problem by doing a getBorder().
>>>
>>> Steve
>>>
>>> On Mon, Mar 22, 2010 at 11:40 AM, Jeremy Thomerson
>>> <je...@wickettraining.com> wrote:
>>> > you need to be adding the components to the form.  you're currently
>>> adding
>>> > them to the page itself.  the component hierarchy is thus broken.  on
>>> your
>>> > child page, either do getForm().add(foo) [you'll need to expose a getForm
>>> > method that returns the form from the parent page] or else on your parent
>>> > page (BaseEditPage), setTransparentResolver(true) on the form and add the
>>> > form children to the page then.
>>> >
>>> > --
>>> > Jeremy Thomerson
>>> > http://www.wickettraining.com
>>> >
>>> >
>>> >
>>> > On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <
>>> steve@whitesquaresoft.com
>>> >> wrote:
>>> >
>>> >> Hi all,
>>> >>
>>> >> Before I go to far trying to prove I have a bug, I thought i'd crowd
>>> >> source an answer.
>>> >>
>>> >> We have a lot of "Edit" pages that have a lot of simmilar structure,
>>> >> and what I wanted to do is create a BaseEditPage that contains the
>>> >> form, the save/cancel buttons, some layout stuff and a FeedbackPanel,
>>> >> then extend it into UserEditPage that just adds the fields that are
>>> >> editable.
>>> >>
>>> >> I can get this working as long as I put all the HTML into the
>>> >> UserEditPage.html file.
>>> >>
>>> >> Lets make this simple.  Lets say that BaseEditPage extends
>>> >> StandardPage, where StandardPage provides a standard header, footer
>>> >> and so all we have to worry about in the BaseEditPage is the "content"
>>> >> of the page.
>>> >>
>>> >> My BaseEditPage html will look like:
>>> >>
>>> >> <wicket:extend>
>>> >> <form wicket:id="form">
>>> >>  <div wicket:id="feedback"/>
>>> >>  <wicket:child/>
>>> >>
>>> >>  <input type="button" wicket:id="save"/>
>>> >>  <input type="button" wicket:id="cancel"/>
>>> >> </form>
>>> >> </wicket:extend>
>>> >>
>>> >> And the BaseEditPage.java is like:
>>> >>
>>> >> public class BaseEditPage extends StandardPage {
>>> >>
>>> >> Form form;
>>> >> SubmitLink saveButton;
>>> >> SubmitLink cancelButton;
>>> >> FeedbackPanel feedbackPanel;
>>> >>
>>> >> public BaseEditPage() {
>>> >>   super();
>>> >>
>>> >>   form = new Form("form");
>>> >>
>>> >>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
>>> >> example simple.
>>> >>   cancelButton = new SubmitLink("cancel");
>>> >>
>>> >>   feedbackPanel = new FeedbackPanel("feedback");
>>> >>
>>> >>   add(form);
>>> >>
>>> >>   form.add(saveButton);
>>> >>   form.add(cancelButton);
>>> >>   form.add(feedbackPanel);
>>> >> }
>>> >> }
>>> >>
>>> >> Now I create my UserEditPage
>>> >>
>>> >> public UserEditPage extends BaseEditPage {
>>> >>
>>> >> RequiredTextField username;
>>> >>
>>> >> public UserEditPage() {
>>> >>    username = new RequiredTextField<String>("username", new
>>> >> Model("test-username"));
>>> >>
>>> >>    add(username);
>>> >> }
>>> >>
>>> >> }
>>> >>
>>> >> And create the HTML for the page like:
>>> >> <wicket:extend>
>>> >>  Username: <input type="text" wicket:id="username"/>
>>> >> </wicket:extend>
>>> >>
>>> >>
>>> >> When I run this simple example I get a messsage stating:
>>> >>    Unable to find component with id 'username' in [MarkupContainer
>>> >> [Component id = _extend4]].
>>> >>
>>> >> My guess is this is an issue processing the sub class due to the fact
>>> >> that the <form> tag is still open.
>>> >>
>>> >> Is there any way to do this, or is this outside the scope of Wicket?
>>> >>
>>> >> Cheers,
>>> >> Steve
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> >> For additional commands, e-mail: users-help@wicket.apache.org
>>> >>
>>> >>
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Forms in a base class

Posted by Igor Vaynberg <ig...@gmail.com>.
dont think that will work. it will work for rendering, but for
processing components it wont work because they really need to be
descendants of the form.

-igor

On Sun, Mar 21, 2010 at 7:08 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> Sorry, override isTransparentResolver.  The set method is only on Border.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Sun, Mar 21, 2010 at 8:00 PM, Steve Mactaggart <
> steve.mactaggart@gmail.com> wrote:
>
>> Excellent,
>>
>> My simple test now seems to work if I do a getForm().
>> Although I really like the thought of setTransparentResolver(), but as
>> with  Josh, I can't find it in 1.4.7..
>>
>> I also have this problem with a Border object, I'll have to look into
>> seeing if I can  get around the same problem by doing a getBorder().
>>
>> Steve
>>
>> On Mon, Mar 22, 2010 at 11:40 AM, Jeremy Thomerson
>> <je...@wickettraining.com> wrote:
>> > you need to be adding the components to the form.  you're currently
>> adding
>> > them to the page itself.  the component hierarchy is thus broken.  on
>> your
>> > child page, either do getForm().add(foo) [you'll need to expose a getForm
>> > method that returns the form from the parent page] or else on your parent
>> > page (BaseEditPage), setTransparentResolver(true) on the form and add the
>> > form children to the page then.
>> >
>> > --
>> > Jeremy Thomerson
>> > http://www.wickettraining.com
>> >
>> >
>> >
>> > On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <
>> steve@whitesquaresoft.com
>> >> wrote:
>> >
>> >> Hi all,
>> >>
>> >> Before I go to far trying to prove I have a bug, I thought i'd crowd
>> >> source an answer.
>> >>
>> >> We have a lot of "Edit" pages that have a lot of simmilar structure,
>> >> and what I wanted to do is create a BaseEditPage that contains the
>> >> form, the save/cancel buttons, some layout stuff and a FeedbackPanel,
>> >> then extend it into UserEditPage that just adds the fields that are
>> >> editable.
>> >>
>> >> I can get this working as long as I put all the HTML into the
>> >> UserEditPage.html file.
>> >>
>> >> Lets make this simple.  Lets say that BaseEditPage extends
>> >> StandardPage, where StandardPage provides a standard header, footer
>> >> and so all we have to worry about in the BaseEditPage is the "content"
>> >> of the page.
>> >>
>> >> My BaseEditPage html will look like:
>> >>
>> >> <wicket:extend>
>> >> <form wicket:id="form">
>> >>  <div wicket:id="feedback"/>
>> >>  <wicket:child/>
>> >>
>> >>  <input type="button" wicket:id="save"/>
>> >>  <input type="button" wicket:id="cancel"/>
>> >> </form>
>> >> </wicket:extend>
>> >>
>> >> And the BaseEditPage.java is like:
>> >>
>> >> public class BaseEditPage extends StandardPage {
>> >>
>> >> Form form;
>> >> SubmitLink saveButton;
>> >> SubmitLink cancelButton;
>> >> FeedbackPanel feedbackPanel;
>> >>
>> >> public BaseEditPage() {
>> >>   super();
>> >>
>> >>   form = new Form("form");
>> >>
>> >>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
>> >> example simple.
>> >>   cancelButton = new SubmitLink("cancel");
>> >>
>> >>   feedbackPanel = new FeedbackPanel("feedback");
>> >>
>> >>   add(form);
>> >>
>> >>   form.add(saveButton);
>> >>   form.add(cancelButton);
>> >>   form.add(feedbackPanel);
>> >> }
>> >> }
>> >>
>> >> Now I create my UserEditPage
>> >>
>> >> public UserEditPage extends BaseEditPage {
>> >>
>> >> RequiredTextField username;
>> >>
>> >> public UserEditPage() {
>> >>    username = new RequiredTextField<String>("username", new
>> >> Model("test-username"));
>> >>
>> >>    add(username);
>> >> }
>> >>
>> >> }
>> >>
>> >> And create the HTML for the page like:
>> >> <wicket:extend>
>> >>  Username: <input type="text" wicket:id="username"/>
>> >> </wicket:extend>
>> >>
>> >>
>> >> When I run this simple example I get a messsage stating:
>> >>    Unable to find component with id 'username' in [MarkupContainer
>> >> [Component id = _extend4]].
>> >>
>> >> My guess is this is an issue processing the sub class due to the fact
>> >> that the <form> tag is still open.
>> >>
>> >> Is there any way to do this, or is this outside the scope of Wicket?
>> >>
>> >> Cheers,
>> >> Steve
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Forms in a base class

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Sorry, override isTransparentResolver.  The set method is only on Border.

--
Jeremy Thomerson
http://www.wickettraining.com



On Sun, Mar 21, 2010 at 8:00 PM, Steve Mactaggart <
steve.mactaggart@gmail.com> wrote:

> Excellent,
>
> My simple test now seems to work if I do a getForm().
> Although I really like the thought of setTransparentResolver(), but as
> with  Josh, I can't find it in 1.4.7..
>
> I also have this problem with a Border object, I'll have to look into
> seeing if I can  get around the same problem by doing a getBorder().
>
> Steve
>
> On Mon, Mar 22, 2010 at 11:40 AM, Jeremy Thomerson
> <je...@wickettraining.com> wrote:
> > you need to be adding the components to the form.  you're currently
> adding
> > them to the page itself.  the component hierarchy is thus broken.  on
> your
> > child page, either do getForm().add(foo) [you'll need to expose a getForm
> > method that returns the form from the parent page] or else on your parent
> > page (BaseEditPage), setTransparentResolver(true) on the form and add the
> > form children to the page then.
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
> >
> > On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <
> steve@whitesquaresoft.com
> >> wrote:
> >
> >> Hi all,
> >>
> >> Before I go to far trying to prove I have a bug, I thought i'd crowd
> >> source an answer.
> >>
> >> We have a lot of "Edit" pages that have a lot of simmilar structure,
> >> and what I wanted to do is create a BaseEditPage that contains the
> >> form, the save/cancel buttons, some layout stuff and a FeedbackPanel,
> >> then extend it into UserEditPage that just adds the fields that are
> >> editable.
> >>
> >> I can get this working as long as I put all the HTML into the
> >> UserEditPage.html file.
> >>
> >> Lets make this simple.  Lets say that BaseEditPage extends
> >> StandardPage, where StandardPage provides a standard header, footer
> >> and so all we have to worry about in the BaseEditPage is the "content"
> >> of the page.
> >>
> >> My BaseEditPage html will look like:
> >>
> >> <wicket:extend>
> >> <form wicket:id="form">
> >>  <div wicket:id="feedback"/>
> >>  <wicket:child/>
> >>
> >>  <input type="button" wicket:id="save"/>
> >>  <input type="button" wicket:id="cancel"/>
> >> </form>
> >> </wicket:extend>
> >>
> >> And the BaseEditPage.java is like:
> >>
> >> public class BaseEditPage extends StandardPage {
> >>
> >> Form form;
> >> SubmitLink saveButton;
> >> SubmitLink cancelButton;
> >> FeedbackPanel feedbackPanel;
> >>
> >> public BaseEditPage() {
> >>   super();
> >>
> >>   form = new Form("form");
> >>
> >>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
> >> example simple.
> >>   cancelButton = new SubmitLink("cancel");
> >>
> >>   feedbackPanel = new FeedbackPanel("feedback");
> >>
> >>   add(form);
> >>
> >>   form.add(saveButton);
> >>   form.add(cancelButton);
> >>   form.add(feedbackPanel);
> >> }
> >> }
> >>
> >> Now I create my UserEditPage
> >>
> >> public UserEditPage extends BaseEditPage {
> >>
> >> RequiredTextField username;
> >>
> >> public UserEditPage() {
> >>    username = new RequiredTextField<String>("username", new
> >> Model("test-username"));
> >>
> >>    add(username);
> >> }
> >>
> >> }
> >>
> >> And create the HTML for the page like:
> >> <wicket:extend>
> >>  Username: <input type="text" wicket:id="username"/>
> >> </wicket:extend>
> >>
> >>
> >> When I run this simple example I get a messsage stating:
> >>    Unable to find component with id 'username' in [MarkupContainer
> >> [Component id = _extend4]].
> >>
> >> My guess is this is an issue processing the sub class due to the fact
> >> that the <form> tag is still open.
> >>
> >> Is there any way to do this, or is this outside the scope of Wicket?
> >>
> >> Cheers,
> >> Steve
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Forms in a base class

Posted by Steve Mactaggart <st...@gmail.com>.
Excellent,

My simple test now seems to work if I do a getForm().
Although I really like the thought of setTransparentResolver(), but as
with  Josh, I can't find it in 1.4.7..

I also have this problem with a Border object, I'll have to look into
seeing if I can  get around the same problem by doing a getBorder().

Steve

On Mon, Mar 22, 2010 at 11:40 AM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> you need to be adding the components to the form.  you're currently adding
> them to the page itself.  the component hierarchy is thus broken.  on your
> child page, either do getForm().add(foo) [you'll need to expose a getForm
> method that returns the form from the parent page] or else on your parent
> page (BaseEditPage), setTransparentResolver(true) on the form and add the
> form children to the page then.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <steve@whitesquaresoft.com
>> wrote:
>
>> Hi all,
>>
>> Before I go to far trying to prove I have a bug, I thought i'd crowd
>> source an answer.
>>
>> We have a lot of "Edit" pages that have a lot of simmilar structure,
>> and what I wanted to do is create a BaseEditPage that contains the
>> form, the save/cancel buttons, some layout stuff and a FeedbackPanel,
>> then extend it into UserEditPage that just adds the fields that are
>> editable.
>>
>> I can get this working as long as I put all the HTML into the
>> UserEditPage.html file.
>>
>> Lets make this simple.  Lets say that BaseEditPage extends
>> StandardPage, where StandardPage provides a standard header, footer
>> and so all we have to worry about in the BaseEditPage is the "content"
>> of the page.
>>
>> My BaseEditPage html will look like:
>>
>> <wicket:extend>
>> <form wicket:id="form">
>>  <div wicket:id="feedback"/>
>>  <wicket:child/>
>>
>>  <input type="button" wicket:id="save"/>
>>  <input type="button" wicket:id="cancel"/>
>> </form>
>> </wicket:extend>
>>
>> And the BaseEditPage.java is like:
>>
>> public class BaseEditPage extends StandardPage {
>>
>> Form form;
>> SubmitLink saveButton;
>> SubmitLink cancelButton;
>> FeedbackPanel feedbackPanel;
>>
>> public BaseEditPage() {
>>   super();
>>
>>   form = new Form("form");
>>
>>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
>> example simple.
>>   cancelButton = new SubmitLink("cancel");
>>
>>   feedbackPanel = new FeedbackPanel("feedback");
>>
>>   add(form);
>>
>>   form.add(saveButton);
>>   form.add(cancelButton);
>>   form.add(feedbackPanel);
>> }
>> }
>>
>> Now I create my UserEditPage
>>
>> public UserEditPage extends BaseEditPage {
>>
>> RequiredTextField username;
>>
>> public UserEditPage() {
>>    username = new RequiredTextField<String>("username", new
>> Model("test-username"));
>>
>>    add(username);
>> }
>>
>> }
>>
>> And create the HTML for the page like:
>> <wicket:extend>
>>  Username: <input type="text" wicket:id="username"/>
>> </wicket:extend>
>>
>>
>> When I run this simple example I get a messsage stating:
>>    Unable to find component with id 'username' in [MarkupContainer
>> [Component id = _extend4]].
>>
>> My guess is this is an issue processing the sub class due to the fact
>> that the <form> tag is still open.
>>
>> Is there any way to do this, or is this outside the scope of Wicket?
>>
>> Cheers,
>> Steve
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Forms in a base class

Posted by Steve Mactaggart <st...@whitesquaresoft.com>.
I have found that you only need to add items directly in the child class to
the form.

We have other panels and components that can be added to each other as you
would normally its just the elements directly inside the sub-class that need
to be added to the form.

Not sure if that helps, or even make sense.

Steve

On Wed, Jul 28, 2010 at 6:52 PM, Wolfgang <wo...@exedio.com>wrote:

>
>
> Jeremy Thomerson-5 wrote:
> >
> > you need to be adding the components to the form.  you're currently
> adding
> > them to the page itself.  the component hierarchy is thus broken.  on
> your
> > child page, either do getForm().add(foo) [you'll need to expose a getForm
> > method that returns the form from the parent page] or else on your parent
> > page (BaseEditPage), setTransparentResolver(true) on the form and add the
> > form children to the page then.
> >
>
> It's working but is far from satisfying... It breaks the encapsulation of
> the sub-classes (and those of the sub-sub-classes) because they have to
> know
> they can't use add() anymore but have to use some addToForm(). Once you
> have
> a form somewhere in the hierarchy, trouble begins.
>
> Also, you cannot declare the form as a transparent resolver anymore which
> means that every component, not only form components, need to use that
> special method. I'm currently trying to find a way to avoid changing all
> the
> hundreds of add() calls in my project...
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Forms-in-a-base-class-tp1891692p2304644.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Forms in a base class

Posted by Wolfgang <wo...@exedio.com>.

Jeremy Thomerson-5 wrote:
> 
> you need to be adding the components to the form.  you're currently adding
> them to the page itself.  the component hierarchy is thus broken.  on your
> child page, either do getForm().add(foo) [you'll need to expose a getForm
> method that returns the form from the parent page] or else on your parent
> page (BaseEditPage), setTransparentResolver(true) on the form and add the
> form children to the page then.
> 

It's working but is far from satisfying... It breaks the encapsulation of
the sub-classes (and those of the sub-sub-classes) because they have to know
they can't use add() anymore but have to use some addToForm(). Once you have
a form somewhere in the hierarchy, trouble begins.

Also, you cannot declare the form as a transparent resolver anymore which
means that every component, not only form components, need to use that
special method. I'm currently trying to find a way to avoid changing all the
hundreds of add() calls in my project...
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Forms-in-a-base-class-tp1891692p2304644.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Forms in a base class

Posted by Josh Chappelle <jc...@4redi.com>.
Jeremy,

What is the setTransparentResolver(true) method? I tried to find it on the
form component and I couldn't? I'm using wicket 1.4.7. 

Thanks,

Josh

-----Original Message-----
From: Jeremy Thomerson [mailto:jeremy@wickettraining.com] 
Sent: Sunday, March 21, 2010 7:40 PM
To: users@wicket.apache.org
Subject: Re: Forms in a base class

you need to be adding the components to the form.  you're currently adding
them to the page itself.  the component hierarchy is thus broken.  on your
child page, either do getForm().add(foo) [you'll need to expose a getForm
method that returns the form from the parent page] or else on your parent
page (BaseEditPage), setTransparentResolver(true) on the form and add the
form children to the page then.

--
Jeremy Thomerson
http://www.wickettraining.com



On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <steve@whitesquaresoft.com
> wrote:

> Hi all,
>
> Before I go to far trying to prove I have a bug, I thought i'd crowd
> source an answer.
>
> We have a lot of "Edit" pages that have a lot of simmilar structure,
> and what I wanted to do is create a BaseEditPage that contains the
> form, the save/cancel buttons, some layout stuff and a FeedbackPanel,
> then extend it into UserEditPage that just adds the fields that are
> editable.
>
> I can get this working as long as I put all the HTML into the
> UserEditPage.html file.
>
> Lets make this simple.  Lets say that BaseEditPage extends
> StandardPage, where StandardPage provides a standard header, footer
> and so all we have to worry about in the BaseEditPage is the "content"
> of the page.
>
> My BaseEditPage html will look like:
>
> <wicket:extend>
> <form wicket:id="form">
>  <div wicket:id="feedback"/>
>  <wicket:child/>
>
>  <input type="button" wicket:id="save"/>
>  <input type="button" wicket:id="cancel"/>
> </form>
> </wicket:extend>
>
> And the BaseEditPage.java is like:
>
> public class BaseEditPage extends StandardPage {
>
> Form form;
> SubmitLink saveButton;
> SubmitLink cancelButton;
> FeedbackPanel feedbackPanel;
>
> public BaseEditPage() {
>   super();
>
>   form = new Form("form");
>
>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
> example simple.
>   cancelButton = new SubmitLink("cancel");
>
>   feedbackPanel = new FeedbackPanel("feedback");
>
>   add(form);
>
>   form.add(saveButton);
>   form.add(cancelButton);
>   form.add(feedbackPanel);
> }
> }
>
> Now I create my UserEditPage
>
> public UserEditPage extends BaseEditPage {
>
> RequiredTextField username;
>
> public UserEditPage() {
>    username = new RequiredTextField<String>("username", new
> Model("test-username"));
>
>    add(username);
> }
>
> }
>
> And create the HTML for the page like:
> <wicket:extend>
>  Username: <input type="text" wicket:id="username"/>
> </wicket:extend>
>
>
> When I run this simple example I get a messsage stating:
>    Unable to find component with id 'username' in [MarkupContainer
> [Component id = _extend4]].
>
> My guess is this is an issue processing the sub class due to the fact
> that the <form> tag is still open.
>
> Is there any way to do this, or is this outside the scope of Wicket?
>
> Cheers,
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Forms in a base class

Posted by Jeremy Thomerson <je...@wickettraining.com>.
you need to be adding the components to the form.  you're currently adding
them to the page itself.  the component hierarchy is thus broken.  on your
child page, either do getForm().add(foo) [you'll need to expose a getForm
method that returns the form from the parent page] or else on your parent
page (BaseEditPage), setTransparentResolver(true) on the form and add the
form children to the page then.

--
Jeremy Thomerson
http://www.wickettraining.com



On Sun, Mar 21, 2010 at 7:35 PM, Steve Mactaggart <steve@whitesquaresoft.com
> wrote:

> Hi all,
>
> Before I go to far trying to prove I have a bug, I thought i'd crowd
> source an answer.
>
> We have a lot of "Edit" pages that have a lot of simmilar structure,
> and what I wanted to do is create a BaseEditPage that contains the
> form, the save/cancel buttons, some layout stuff and a FeedbackPanel,
> then extend it into UserEditPage that just adds the fields that are
> editable.
>
> I can get this working as long as I put all the HTML into the
> UserEditPage.html file.
>
> Lets make this simple.  Lets say that BaseEditPage extends
> StandardPage, where StandardPage provides a standard header, footer
> and so all we have to worry about in the BaseEditPage is the "content"
> of the page.
>
> My BaseEditPage html will look like:
>
> <wicket:extend>
> <form wicket:id="form">
>  <div wicket:id="feedback"/>
>  <wicket:child/>
>
>  <input type="button" wicket:id="save"/>
>  <input type="button" wicket:id="cancel"/>
> </form>
> </wicket:extend>
>
> And the BaseEditPage.java is like:
>
> public class BaseEditPage extends StandardPage {
>
> Form form;
> SubmitLink saveButton;
> SubmitLink cancelButton;
> FeedbackPanel feedbackPanel;
>
> public BaseEditPage() {
>   super();
>
>   form = new Form("form");
>
>   saveButton = new SubmitLink("save"); //onSubmit excluded to keep
> example simple.
>   cancelButton = new SubmitLink("cancel");
>
>   feedbackPanel = new FeedbackPanel("feedback");
>
>   add(form);
>
>   form.add(saveButton);
>   form.add(cancelButton);
>   form.add(feedbackPanel);
> }
> }
>
> Now I create my UserEditPage
>
> public UserEditPage extends BaseEditPage {
>
> RequiredTextField username;
>
> public UserEditPage() {
>    username = new RequiredTextField<String>("username", new
> Model("test-username"));
>
>    add(username);
> }
>
> }
>
> And create the HTML for the page like:
> <wicket:extend>
>  Username: <input type="text" wicket:id="username"/>
> </wicket:extend>
>
>
> When I run this simple example I get a messsage stating:
>    Unable to find component with id 'username' in [MarkupContainer
> [Component id = _extend4]].
>
> My guess is this is an issue processing the sub class due to the fact
> that the <form> tag is still open.
>
> Is there any way to do this, or is this outside the scope of Wicket?
>
> Cheers,
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Forms in a base class

Posted by Iain Reddick <ia...@beatsystems.com>.
If you want to use inheritance:

Put your base form in a panel with the associated markup for the base 
fields (making sure there is a <wicket:child /> tag in the correct 
place). Then just extend this panel, adding the required "child" form 
components and supplying the appropriate markup extension (using 
<wicket:extend>). Remember that the child form components need to be 
added to the form in the base panel.

You could also use composition instead of inheritance:

Create a panel for the block of "base" form fields (e.g. name + 
description) and then add it to the "child" forms. Basically makes the 
base form components into a composite form component. Benefit of this 
method is that the overall form layout is controlled by the child form.

Elad Katz wrote:
> Hi All, I'm sorry if this is off-topic but I have a problem that's very
> similar and since you are talking about this here and seem to know what
> you're doing, I was thinking you might be able to help.
> I'm trying to create a basic form that all other forms in my project will
> extend, it's gonna have basic fields like name and description, and the rest
> (type specific fields) will be implemented by the children.
> however, my question is, does a form have an associated html file like a
> panel, or should all the children write the name and description fields in
> their respective markups?
> Now I saw that you're using a different methodology, which could maybe apply
> to my use case, but this method makes more sense to me but maybe it's not
> possible.
> just to reiterate, here's what I'm trying to do:
> Let's say i have 2 Pages A and B
> Now these both share a form that has a name and description field (and a
> specific ajax submit button and action)
> so page 1 will have a line like:
> add(new BaseForm());
> and then we will add other fields to that form
> and the same will be in page 2
> but the question is, will this form have an associated html?
> are we going to have to write the html with the name and description wicket
> fields on each page that has that form, or is there a way to generalize it?
> or should i just use the method defined in the thread above?
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Forms in a base class

Posted by Elad Katz <el...@xtify.com>.
Hi All, I'm sorry if this is off-topic but I have a problem that's very
similar and since you are talking about this here and seem to know what
you're doing, I was thinking you might be able to help.
I'm trying to create a basic form that all other forms in my project will
extend, it's gonna have basic fields like name and description, and the rest
(type specific fields) will be implemented by the children.
however, my question is, does a form have an associated html file like a
panel, or should all the children write the name and description fields in
their respective markups?
Now I saw that you're using a different methodology, which could maybe apply
to my use case, but this method makes more sense to me but maybe it's not
possible.
just to reiterate, here's what I'm trying to do:
Let's say i have 2 Pages A and B
Now these both share a form that has a name and description field (and a
specific ajax submit button and action)
so page 1 will have a line like:
add(new BaseForm());
and then we will add other fields to that form
and the same will be in page 2
but the question is, will this form have an associated html?
are we going to have to write the html with the name and description wicket
fields on each page that has that form, or is there a way to generalize it?
or should i just use the method defined in the thread above?

-- 
View this message in context: http://old.nabble.com/Forms-in-a-base-class-tp27981164p28153812.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org