How to include forms into FTL?

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

How to include forms into FTL?

Bruno Busco
Hi,
I need to include a form widget from an ftl file.

Is there an instruction equivalent to:
     ${screens.render(ScreenLocation, ScreenName)}

but for forms?

Something like
     ${forms.render(FormLocation, FormName)}


Many thanks for any help.

-Bruno
Reply | Threaded
Open this post in threaded view
|

Re: How to include forms into FTL?

Bilgin Ibryam-2
Bruno Busco wrote:

> Hi,
> I need to include a form widget from an ftl file.
>
> Is there an instruction equivalent to:
>      ${screens.render(ScreenLocation, ScreenName)}
>
> but for forms?
>
> Something like
>      ${forms.render(FormLocation, FormName)}
>
>
> Many thanks for any help.
>
> -Bruno
>  
Hi Bruno,

Look at HtmlFormWrapper usage in  EditShipment.groovy and
EditShipment.ftl for an example.

Bilgin
Reply | Threaded
Open this post in threaded view
|

Re: How to include forms into FTL?

Bruno Busco
Thank you Bilgin,
there is no way to do everything in the FTL?
I need to add a groovy?

-Bruno

2010/1/17 Bilgin Ibryam <[hidden email]>:

> Bruno Busco wrote:
>>
>> Hi,
>> I need to include a form widget from an ftl file.
>>
>> Is there an instruction equivalent to:
>>     ${screens.render(ScreenLocation, ScreenName)}
>>
>> but for forms?
>>
>> Something like
>>     ${forms.render(FormLocation, FormName)}
>>
>>
>> Many thanks for any help.
>>
>> -Bruno
>>
>
> Hi Bruno,
>
> Look at HtmlFormWrapper usage in  EditShipment.groovy and EditShipment.ftl
> for an example.
>
> Bilgin
>
Reply | Threaded
Open this post in threaded view
|

Re: How to include forms into FTL?

Bilgin Ibryam-2
Bruno Busco wrote:
> Thank you Bilgin,
> there is no way to do everything in the FTL?
>  
 I'm not aware of a way to do it in ftl. But may be you can create a
generic screen, which has only one form and takes the form name and
location from context. Then in your ftl you can set the form name and
location and render the screen. Just an idea.

Bilgin

> I need to add a groovy?
>
> -Bruno
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: How to include forms into FTL?

Jacopo Cappellato-4
In reply to this post by Bruno Busco

On Jan 17, 2010, at 1:18 PM, Bruno Busco wrote:

> Thank you Bilgin,
> there is no way to do everything in the FTL?
> I need to add a groovy?

Yes, I think that you need to prepare the object in a script; it would be nice to create an ftl transformation to do this directly in the freemarker template.

Kind regards,

Jacopo


>
> -Bruno
>
> 2010/1/17 Bilgin Ibryam <[hidden email]>:
>> Bruno Busco wrote:
>>>
>>> Hi,
>>> I need to include a form widget from an ftl file.
>>>
>>> Is there an instruction equivalent to:
>>>     ${screens.render(ScreenLocation, ScreenName)}
>>>
>>> but for forms?
>>>
>>> Something like
>>>     ${forms.render(FormLocation, FormName)}
>>>
>>>
>>> Many thanks for any help.
>>>
>>> -Bruno
>>>
>>
>> Hi Bruno,
>>
>> Look at HtmlFormWrapper usage in  EditShipment.groovy and EditShipment.ftl
>> for an example.
>>
>> Bilgin
>>

Reply | Threaded
Open this post in threaded view
|

Re: How to include forms into FTL?

Bruno Busco
Sorry for the basic question.
But how can I pass a parameter from an FTL to an included screen ?

-Bruno

2010/1/17 Jacopo Cappellato <[hidden email]>:

>
> On Jan 17, 2010, at 1:18 PM, Bruno Busco wrote:
>
>> Thank you Bilgin,
>> there is no way to do everything in the FTL?
>> I need to add a groovy?
>
> Yes, I think that you need to prepare the object in a script; it would be nice to create an ftl transformation to do this directly in the freemarker template.
>
> Kind regards,
>
> Jacopo
>
>
>>
>> -Bruno
>>
>> 2010/1/17 Bilgin Ibryam <[hidden email]>:
>>> Bruno Busco wrote:
>>>>
>>>> Hi,
>>>> I need to include a form widget from an ftl file.
>>>>
>>>> Is there an instruction equivalent to:
>>>>     ${screens.render(ScreenLocation, ScreenName)}
>>>>
>>>> but for forms?
>>>>
>>>> Something like
>>>>     ${forms.render(FormLocation, FormName)}
>>>>
>>>>
>>>> Many thanks for any help.
>>>>
>>>> -Bruno
>>>>
>>>
>>> Hi Bruno,
>>>
>>> Look at HtmlFormWrapper usage in  EditShipment.groovy and EditShipment.ftl
>>> for an example.
>>>
>>> Bilgin
>>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to include forms into FTL?

Bruno Busco
I mean, I have this:

FTL file
      <#list portalPagePortlets as portlet>
...
                  <#if (portlet.editFormName?has_content &&
portlet.editFormLocation?has_content)>

${screens.render("component://common/widget/PortalPageScreens.xml",
"EditPortlet")}
                  </#if>
...
      </#list>

and in the PortalPageScreens.xml file:

    <screen name="EditPortlet">
            <widgets>
                <include-form name="${portlet.editFormName}"
location="${portlet.editFormLocation}"/>
            </widgets>
        </section>
    </screen>

The fields portlet.editFormName and portlet.editFormLocation have no
value in the screen. How can I make the FTL file set a field in the
context?

Thank you,
Bruno


2010/1/17 Bruno Busco <[hidden email]>:

> Sorry for the basic question.
> But how can I pass a parameter from an FTL to an included screen ?
>
> -Bruno
>
> 2010/1/17 Jacopo Cappellato <[hidden email]>:
>>
>> On Jan 17, 2010, at 1:18 PM, Bruno Busco wrote:
>>
>>> Thank you Bilgin,
>>> there is no way to do everything in the FTL?
>>> I need to add a groovy?
>>
>> Yes, I think that you need to prepare the object in a script; it would be nice to create an ftl transformation to do this directly in the freemarker template.
>>
>> Kind regards,
>>
>> Jacopo
>>
>>
>>>
>>> -Bruno
>>>
>>> 2010/1/17 Bilgin Ibryam <[hidden email]>:
>>>> Bruno Busco wrote:
>>>>>
>>>>> Hi,
>>>>> I need to include a form widget from an ftl file.
>>>>>
>>>>> Is there an instruction equivalent to:
>>>>>     ${screens.render(ScreenLocation, ScreenName)}
>>>>>
>>>>> but for forms?
>>>>>
>>>>> Something like
>>>>>     ${forms.render(FormLocation, FormName)}
>>>>>
>>>>>
>>>>> Many thanks for any help.
>>>>>
>>>>> -Bruno
>>>>>
>>>>
>>>> Hi Bruno,
>>>>
>>>> Look at HtmlFormWrapper usage in  EditShipment.groovy and EditShipment.ftl
>>>> for an example.
>>>>
>>>> Bilgin
>>>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to include forms into FTL?

Bilgin Ibryam-2
Bruno Busco wrote:

Bruno, I cannot see an easy way to set the variables in context, but
there is still a way to do it. Please see inline
> I mean, I have this:
>
> FTL file
>       <#list portalPagePortlets as portlet>
> ...
>                   <#if (portlet.editFormName?has_content &&
> portlet.editFormLocation?has_content)>
>
>  

${setRequestAttribute("editFormName", editFormName)}

> ${screens.render("component://common/widget/PortalPageScreens.xml",
> "EditPortlet")}
>                   </#if>
> ...
>       </#list>
>
> and in the PortalPageScreens.xml file:
>
>     <screen name="EditPortlet">
>  
            <actions>
                <set field="editFormName" value="${groovy:   return
request.getAttribute('editFormName');}"/>
            </actions>

>             <widgets>
>                 <include-form name="${editFormName}"
> location="${portlet.editFormLocation}"/>
>             </widgets>
>         </section>
>     </screen>
>
> The fields portlet.editFormName and portlet.editFormLocation have no
> value in the screen. How can I make the FTL file set a field in the
> context?
>
> Thank you,
> Bruno
>
>
>