Yes, exactly: this potential way of sharing ui code was one of the main motivations for the switch to macros.
Jacopo On Feb 18, 2010, at 10:25 PM, Scott Gray wrote: > Hi Bruno, > > That was one of the ideas put forward when the conversion to FTL macros took > place. > > I would be in favor of creating a set of template directives that would > facilitate something like this. > > Regards > Scott > > HotWax Media > http://www.hotwaxmedia.com > > On 18/02/2010, at 2:16 PM, Bruno Busco wrote: > >> Hi list, >> in many forms implemented in FTL there are fields that generates a >> different HTML from the one that is generated for the equivalent >> formfield widget. >> >> For example many lookup fields are implemented in the FTL like this: >> >> <input type="text" size="20" maxlength="20" name="productId" value=""/> >> <a >> href="javascript:call_fieldlookup2(document.EditProductForm.productId,'LookupProduct');"><img >> src='/images/fieldlookup.gif' width='15' height='14' border='0' >> alt="${uiLabelMap.CommonClickHereForFieldLookup}"/></a> >> >> A completely different HTML is generated for the formfield widget >> using the markup that is defined in the htmlFormMacroLibrary.ftl file. >> >> Could we think a way to let to easily generate in the FTL the same >> HTML of the form widget? >> >> I mean, could we think to define a macro that calls the macro >> htmlFormMacroLibrary.ftl so, in place of the code above, we could use >> something like: >> <@tpl.fieldLookup name="productId" fieldId="productId" >> size=20 maxlength=20 value="" lookup="LookupProduct"/> >> The fieldLookup macro should call the renderLookupField in the >> htmlFormMacroLibrary.ftl file. >> >> What do you think? >> Does this make sense? >> >> Thank you >> -Bruno >