how to move variable from a FTL file to a Screen

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

how to move variable from a FTL file to a Screen

Patrick-4
In my FTL file I call
${screens.render("component://common/widget/CommonScreens.xml#AddProducerToFacility")}

but I need the variable facilityId at that screen level.  In my FTL I
tried this

<#assign parameters.facilityId="4"/>
<#assign context.facilityId="4"/>

and various other combinations.  How can I pass a variable from an FTL
to a screen?
Reply | Threaded
Open this post in threaded view
|

Re: how to move variable from a FTL file to a Screen

Adrian Crum
Try

<#assign globalContext.facilityId="4"/>

It might be a scope issue where higher-level artifacts can't see
variables declared in lower-level artifacts. All artifacts can see the
global context.

-Adrian

On 5/19/2010 1:36 PM, Patrick wrote:

> In my FTL file I call
> ${screens.render("component://common/widget/CommonScreens.xml#AddProducerToFacility")}
>
> but I need the variable facilityId at that screen level.  In my FTL I
> tried this
>
> <#assign parameters.facilityId="4"/>
> <#assign context.facilityId="4"/>
>
> and various other combinations.  How can I pass a variable from an FTL
> to a screen?
>
Reply | Threaded
Open this post in threaded view
|

Re: how to move variable from a FTL file to a Screen

Vicky Park
In reply to this post by Patrick-4
How about to utilize this code?

<#if productIds?has_content>
<#list productIds as productId>
         ${setRequestAttribute("name1", value1)} <#-- assign value1-->
         ${setRequestAttribute("name2", value2)} <#-- assign value1-->
         ${setRequestAttribute("name3", value3)} <#-- assign value1-->

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

Let me know if doesn't work.

Regards,
Soon-Won Park

On 5/19/2010 4:36 PM, Patrick wrote:

> In my FTL file I call
> ${screens.render("component://common/widget/CommonScreens.xml#AddProducerToFacility")}
>
> but I need the variable facilityId at that screen level.  In my FTL I
> tried this
>
> <#assign parameters.facilityId="4"/>
> <#assign context.facilityId="4"/>
>
> and various other combinations.  How can I pass a variable from an FTL
> to a screen?
>
>    


Reply | Threaded
Open this post in threaded view
|

Re: how to move variable from a FTL file to a Screen

Bruno Busco
In reply to this post by Adrian Crum
Hi Adrian,
I am trying to assign a value to globalContext in a FTL file but receive
this error:

Expression globalContext is undefined on line 192, column 3 in
component://widget/templates/htmlScreenMacroLibrary.ftl


I am trying to use this tecnique to finalize the patch in this JIRA
https://issues.apache.org/jira/browse/OFBIZ-3625

I have not found any example of setting of globalContext in FTL in OFBiz.
Could you please help me on this?

-Bruno


2010/5/19 Adrian Crum <[hidden email]>

> Try
>
> <#assign globalContext.facilityId="4"/>
>
> It might be a scope issue where higher-level artifacts can't see variables
> declared in lower-level artifacts. All artifacts can see the global context.
>
> -Adrian
>
>
> On 5/19/2010 1:36 PM, Patrick wrote:
>
>> In my FTL file I call
>>
>> ${screens.render("component://common/widget/CommonScreens.xml#AddProducerToFacility")}
>>
>> but I need the variable facilityId at that screen level.  In my FTL I
>> tried this
>>
>> <#assign parameters.facilityId="4"/>
>> <#assign context.facilityId="4"/>
>>
>> and various other combinations.  How can I pass a variable from an FTL
>> to a screen?
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: how to move variable from a FTL file to a Screen

Patrick-4
Hi Bruno,
do this in your ftl
<#assign parameters=context.parameters/>
<#assign tmp=parameters.put("partyId", partyId)/>
-patrick

On Sat, May 29, 2010 at 1:03 AM, Bruno Busco <[hidden email]> wrote:

> Hi Adrian,
> I am trying to assign a value to globalContext in a FTL file but receive
> this error:
>
> Expression globalContext is undefined on line 192, column 3 in
> component://widget/templates/htmlScreenMacroLibrary.ftl
>
>
> I am trying to use this tecnique to finalize the patch in this JIRA
> https://issues.apache.org/jira/browse/OFBIZ-3625
>
> I have not found any example of setting of globalContext in FTL in OFBiz.
> Could you please help me on this?
>
> -Bruno
>
>
> 2010/5/19 Adrian Crum <[hidden email]>
>
>> Try
>>
>> <#assign globalContext.facilityId="4"/>
>>
>> It might be a scope issue where higher-level artifacts can't see variables
>> declared in lower-level artifacts. All artifacts can see the global context.
>>
>> -Adrian
>>
>>
>> On 5/19/2010 1:36 PM, Patrick wrote:
>>
>>> In my FTL file I call
>>>
>>> ${screens.render("component://common/widget/CommonScreens.xml#AddProducerToFacility")}
>>>
>>> but I need the variable facilityId at that screen level.  In my FTL I
>>> tried this
>>>
>>> <#assign parameters.facilityId="4"/>
>>> <#assign context.facilityId="4"/>
>>>
>>> and various other combinations.  How can I pass a variable from an FTL
>>> to a screen?
>>>
>>>
>