You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Bruno Busco <br...@gmail.com> on 2010/02/18 22:16:01 UTC

FormFields in FTL files

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

Re: FormFields in FTL files

Posted by Bilgin Ibryam <bi...@gmail.com>.
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
>   
+ 1
Then we will have some of widget lookup features in ftl lookups 
(autocompleter, layered lookup)

Bilgin

Re: FormFields in FTL files

Posted by Bruno Busco <br...@gmail.com>.
I have done a little work on this and attached a patch here:
https://issues.apache.org/jira/browse/OFBIZ-3541

please, could you review it?

Thank you,
Bruno

2010/2/19 Jacopo Cappellato <ja...@hotwaxmedia.com>:
> 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
>>
>
>

Re: FormFields in FTL files

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
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
> 


Re: FormFields in FTL files

Posted by Adrian Crum <ad...@hlmksw.com>.
+1

I'm a big fan of reusable code.

-Adrian

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
> 

Re: FormFields in FTL files

Posted by Scott Gray <sc...@hotwaxmedia.com>.
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