What you need is a combination of Loop, Delegate, and SubmitNotifier
components and a couple of blocks inside your template. Check this out:

http://code.google.com/p/tapestrybook/source/browse/trunk/tapestry-dynamic-forms/src/main/webapp/ViewReport.tml
http://code.google.com/p/tapestrybook/source/browse/trunk/tapestry-dynamic-forms/src/main/java/de/t5book/pages/ViewReport.java

On Sat, Sep 18, 2010 at 12:03 AM, Антон Мезерный <anton.meze...@gmail.com>wrote:

> And what is the best way to create such a dynamic form? Using Delegate
> component or modifying beaneditform? Or maybe there is better approach?
>
> I tried to write it using Delegate and I have a problem - I can't get
> component instance from ComponentSource - Exception:
>
> org.apache.tapestry5.internal.services.RenderQueueException
> Render queue error in BeginRender[Step:dynamicformfield.delegate]: Failure
> reading parameter 'to' of component Step:dynamicformfield.delegate: Unable
> to resolve 'textfield' to a known page name. Available page names: (blank),
> About, Contact, ExceptionReport, Index, PropertyDisplayBlocks,
> PropertyEditBlocks, ServiceStatus, Step.
>
> Why is it looking for a page, not component?
>
> 2010/9/17 Thiago H. de Paula Figueiredo <thiag...@gmail.com>
>
> > On Thu, 16 Sep 2010 19:09:05 -0300, Антон Мезерный <
> > anton.meze...@gmail.com> wrote:
> >
> >  Hello,
> >>
> >
> > Hi!
> >
> >
> >  I am trying to make a dynamic form component, something like
> beaneditform,
> >> but based not on bean field type, but on some property in database.
> >>
> >
> > I strongly advise you to read the BeanEditor sources and do something
> > similar or, better yet, contribute viewing and edition blocks. The end of
> > this page shows you how to add blocks:
> > http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html. Besides
> > that, create one of more DataTypeAnalyzer and contribute them to the
> > DataTypeAnalyzer service. See
> > http://tapestry.1045711.n5.nabble.com/Custom-Edit-Block-td2427355.htmlfor
> > a little more detail.
> >
> >
> >  Another words I want to create something like
> >> <t:${componentNameFromDB} ...>
> >>
> >
> > Short answer: you can't. Tapestry pages and components have stricly
> static
> > structure.
> > Long answer: you can use blocks (<t:block>) and the Delegate component to
> > render blocks or components dynamically.
> >
> >
> >  I tried to use delegate component, but as I understood, I should define
> >> all my components (inputs and other) inside one tml-page in block tags
> and
> >>
> >
> > Not necessarily in a single page.
> >
> >
> >  create block instances in java code. Can I do that with separate
> >> components for every element in the form?
> >>
> >
> > Yes.
> >
> >
> >  What is the best way to achieve it?
> >>
> >
> > ComponentSource will help you to grab page instances.
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> > and instructor
> > Owner, Ars Machina Tecnologia da Informação Ltda.
> > http://www.arsmachina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Reply via email to