Some more info: If I do fieldset > textfield it works fine. But if I do
three nested fieldsets like: fieldset > fieldset > fieldset then when it
renders the last fieldset (or any element) it doesn't actually evaluate
the called to getBlock in the @RenderBlock. Am I missing something? Here
is basically the block that renders the fieldset:

<block jwcid="[EMAIL PROTECTED]">
  <for jwcid="@For"
source="ognl:components.fieldset.getParameter('element').fields"
value="ognl:fieldSetField" volatile="ognl:true">
    <comp jwcid="@RenderBlock" block="getBlock()"
element="ognl:fieldSetField" />
  </for>
</block>

Why would it evaluate the getBlock() expression when the second fieldset
renders but not on the third? Also, getBlock() seems to be the only
expression that *doesn't* get rendered. Does this have something to do
with parameter caching or is this something else? Is Tapestry doing
something I'm not aware of? Thanks.

On Wed, 2006-08-02 at 12:59 -0400, Dan Adams wrote:
> One of the pages in the project I'm working on basically reads an xml
> file and then dynamically builds a form at render time with a number of
> components based on the xml. And of course I'm using @Blocks to do this.
> So I have something like this (pseudotemplate):
> 
> <for source="fields" value="field">
>   <renderblock block="(the block for this field type" />
> </for>
> 
> <block jwcid="[EMAIL PROTECTED]">renders a text field</block>
> <block jwcid="[EMAIL PROTECTED]">renders a property selection</block>
> <block jwcid="[EMAIL PROTECTED]">renders a checkbox</block>
> ...
> 
> this was going fine and worked like a charm until i tried to do one that
> renders a fieldset. a fieldset may contain any number of other fields
> including other fieldsets. so no we have to handle recursion. initially,
> i tried something like this:
> 
> <block jwcid="[EMAIL PROTECTED]">
>   <for source="fieldset.fields" value="field">
>     <renderblock block="(the block for this field type" />
>   </for>
> </block>
> 
> which i think works unless you try to put a fieldset within a fieldset.
> one of the problems I think is that @For caches it's parameters. so i
> moved to something like this:
> 
> <block jwcid="[EMAIL PROTECTED]">
>   <comp jwcid="@RenderFieldSet" fieldset="fieldset" />
> </block>
> 
> and a component @RenderFieldSet:
>   <for source="fieldset.fields" value="field">
>     <renderblock block="(the block for this field type from the original
> page)" />
>   </for>
> 
> but I'm still having problems with the @For loop and the problem I'm
> currently having is that if you have: fieldset > fieldset > textfield
> then it appears that the binding value for renderblock is being cached
> or something. basically it renders the wrong block for the textfield
> because it's not evaluating the expression to calculate it (it's using
> the fieldset block).
> 
> Can anyone offer *any* advice or suggestions on a fix or
> different/better approach? I'm trying to find a solution to this (forget
> about an elegant solution) and I'm hitting problem after problem after
> problem. Thanks in advance. Sorry for the long email.
> 
> Also, congrats on getting 4.1 out, Jesse. :)
> 
-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to