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 Software Engineer Interactive Factory 617.235.5857 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]