You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Robert Wills <ro...@dicta.org.uk> on 2004/03/02 23:45:20 UTC

Editing 2 data objects in the same form

Hello,

I've received a spec for a page which requires me to edit two data
objects (we're using hibernate) which are both of the same class in the
same form.  Ideally I'd like to make a component for editing that data
object so that I can just put two components in the form instead of
having two sets of basically identical fields in the form.  My question
then is what is the best way of creating a component with multiple
TextFields that I can put in a form?

I've looked at just creating a plain component which extends
BaseComponent but that doesn't seem to be able to pick up or read data
back to the form.  I've also looked at doing it as a component which
extends AbstractFormComponent but that seems to require that I override
RenderComponent so I end up not being able to use an html file for
specifying the fields.  Another option (which I am currently leaning
towards) is to use a ListEdit which puts each attribute of the data
object that needs editing as an item in a list.

Does anyone have any advice as to what might work best?  Thanks in
advance for any responses.

-Rob  


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Editing 2 data objects in the same form

Posted by Karel Miarka <ka...@issa.cz>.
Hi,

I think that the best way for you is to create a component extending
BaseComponent, because such a component can have a template (.html) where
you can easily layout your TextFields or ValidFields
(components extending AbstractComponent don't have templates). Any component
can have input/output parameters declared using <parameter> tag in your
component specification (.jwc) like this:

  <parameter name="label" type="java.lang.String" direction="in"
required="yes"/>
  <parameter name="value" type="java.lang.Object" direction="auto"
required="yes"/>
  <parameter name="editing" type="boolean" direction="in" required="no"/>

The direction attribute can have those values:
in - only input, getter is created by Tapestry
form - input/output, getter and setter is created by Tapestry  (but this
doesn't work for me, it throws some strange exception)
auto - input/output parameter working fine for me (getter and setter is
provided by Tapestry in the enhanced class)
custom - no getter/setter provided you must handle it manually

If you want to know more about this I suggest you to buy and download
Howard's book Tapestry In Action from www.manning.com it is definitely worth
$22!!!

Regards,
Karel


----- Original Message ----- 
From: "Robert Wills" <ro...@dicta.org.uk>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, March 02, 2004 11:45 PM
Subject: Editing 2 data objects in the same form


> Hello,
>
> I've received a spec for a page which requires me to edit two data
> objects (we're using hibernate) which are both of the same class in the
> same form.  Ideally I'd like to make a component for editing that data
> object so that I can just put two components in the form instead of
> having two sets of basically identical fields in the form.  My question
> then is what is the best way of creating a component with multiple
> TextFields that I can put in a form?
>
> I've looked at just creating a plain component which extends
> BaseComponent but that doesn't seem to be able to pick up or read data
> back to the form.  I've also looked at doing it as a component which
> extends AbstractFormComponent but that seems to require that I override
> RenderComponent so I end up not being able to use an html file for
> specifying the fields.  Another option (which I am currently leaning
> towards) is to use a ListEdit which puts each attribute of the data
> object that needs editing as an item in a list.
>
> Does anyone have any advice as to what might work best?  Thanks in
> advance for any responses.
>
> -Rob
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org