Hey Slava, thanks for the helpful response.

Yes, I might see if I can extend the code a little. I guess there are
roughly two ways of doing it. Either (i) chloe templates have access
to data from parent forms by default (i.e. you can write <t:label
t:name="parent.parent.foo" />) or (ii) templates continue to operate
in a flat namespace, but there is a means of accessing values from
parent forms in factor controller code. In the case of (ii), you would
manually copy those values of interest into the child template's
namespace in the >>init quotation (or wherever).

Do you have any view on which (if either) is the better approach? I
guess there would also be issues regarding where validation errors
live. I haven't made much use of the validations system yet so I don't
have any ideas about how this would work.

For the moment, I think I will just generate the list XML in factor
using the child template, then bung the generated XML into the parent
template. I hadn't thought of doing this when I originally posted, but
it seems like an ok workaround.

Alex

On 11 February 2010 07:23, Slava Pestov <sl...@factorcode.org> wrote:
> Hi Alex,
>
> The reason you can't do what you want to do is that both the
> boilerplate and action responders call begin-form at the top of their
> call-responder* methods.
>
> Chloe forms are built on top of actions and the machinery in the
> html.forms vocabulary. Nesting forms is supported only to the extent
> that validation errors work properly for a page with multiple forms.
> For example, in the pastebin, a Chloe template renders the actual
> paste, and there is a "sub-template" with the form for adding an
> annotation. Validation errors in the annotation form appear on the
> annotation template's components, instead of on components of the same
> name in the paste template.
>
> To support what you want to do, the templating code needs to be
> extended to support nested templates in a more advanced way. In
> particular, Chloe tags for placing components need to be able to
> address values from parent forms as well as child forms, using some
> kind of namespacing syntax.
>
> If that's a project you feel like taking on, let me know ;-)
>
> Slava
>
> On Thu, Feb 11, 2010 at 7:09 PM, Alex Drummond
> <a.d.drumm...@googlemail.com> wrote:
>> Hi,
>>
>> I've noticed that values from the parent template don't seem to be
>> available to a child template rendered via <t:call-next-template>. I
>> would like to render a list of records, with the html template for
>> each record in a separate template file. Could anyone tell me the best
>> way to do this with Chloe? The child template is also used to render
>> individual records in other contexts, so I'd really like to keep it in
>> its own file.
>>
>> thanks,
>> Alex
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to