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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to