FormFields in FTL files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

FormFields in FTL files

Bruno Busco
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
Reply | Threaded
Open this post in threaded view
|

Re: FormFields in FTL files

Scott Gray-2
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


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FormFields in FTL files

Adrian Crum
+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
>
Reply | Threaded
Open this post in threaded view
|

Re: FormFields in FTL files

Bilgin Ibryam-2
In reply to this post by Bruno Busco
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
Reply | Threaded
Open this post in threaded view
|

Re: FormFields in FTL files

Jacopo Cappellato-4
In reply to this post by Scott Gray-2
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
>

Reply | Threaded
Open this post in threaded view
|

Re: FormFields in FTL files

Bruno Busco
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 <[hidden email]>:

> 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
>>
>
>