Questions about form list and use-when

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

Questions about form list and use-when

matarazzo angelo
Hi,
I'm studying use-when tag  in list-forms and I have a few questions:

1)I would like to do

<field name="name" title="${uiLabelMap.CommonName} "
                         use-when="name.equals(&quot;Jack&quot;)">
                        <display also-hidden="true" description="${name}" />
                </field>
But there isn't  variable "name" in the context and so use-when doesn't work.
How can I display the specific value of "name" only if it is Jack?

2)Also

<form name="ListName" type="multi" >
.
.

<set field="contextVariable" value="commonValue"/>
.
.
.
<field use-when="contextVariablename.equals(&quot;commonValue&quot;)" name="name">
                        <display />
                </field>

<field name="submitButton" title="${uiLabelMap.CommonRemove}--&gt;" use-when="contextVariablename.equals(&quot;commonValue&quot;)">
                        <submit button-type="button" />
                </field>

The field "submitButton" unlike "name",  is always displayed Why?


Thank you for your time.
Reply | Threaded
Open this post in threaded view
|

Re: Questions about form list and use-when

Eric DE MAULDE
See sreen context variables and visitor sub-variable
http://docs.ofbiz.org/pages/viewpage.action?pageId=4459

Eric

----- Original Message -----
From: "Angelo Matarazzo" <[hidden email]>
To: <[hidden email]>
Sent: Sunday, November 09, 2008 10:04 PM
Subject: Questions about form list and use-when


>
> Hi,
> I'm studying use-when tag  in list-forms and I have a few questions:
>
> 1)I would like to do
>
> <field name="name" title="${uiLabelMap.CommonName} "
> use-when="name.equals(&quot;Jack&quot;)">
> <display also-hidden="true" description="${name}" />
> </field>
> But there isn't  variable "name" in the context and so use-when doesn't
> work.
> How can I display the specific value of "name" only if it is Jack?
>
> 2)Also
>
> <form name="ListName" type="multi" >
> .
> .
>
> <set field="contextVariable" value="commonValue"/>
> .
> .
> .
> <field use-when="contextVariablename.equals(&quot;commonValue&quot;)"
> name="name">
> <display />
> </field>
>
> <field name="submitButton" title="${uiLabelMap.CommonRemove}--&gt;"
> use-when="contextVariablename.equals(&quot;commonValue&quot;)">
> <submit button-type="button" />
> </field>
>
> The field "submitButton" unlike "name",  is always displayed Why?
>
>
> Thank you for your time.
>
> --
> View this message in context:
> http://www.nabble.com/Questions-about-form-list-and-use-when-tp20410825p20410825.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Questions about form list and use-when

matarazzo angelo
Hi, Eric
thank you.
However I resolved in this way:
field name="name" title="${uiLabelMap.CommonName} ">
<display also-hidden="true" description="${bsh:if(name.equals(&quotJack&quot))  return name; else return "} />
 </field>
 In your opinion is't right?
About second question?

<form name="ListName" type="multi" >
 .
 .
<actions>
 <set field="contextVariable" value="commonValue"/>
<actions/>

 
 <field use-when="contextVariablename.equals(&quot;commonValue&quot;)"
 name="name">
 <display />
</field>

<field name="submitButton" title="${uiLabelMap.CommonRemove}--&gt;"
use-when="contextVariablename.equals(&quot;commonValue&quot;)">
 <submit button-type="button" />
 </field>

 The field "submitButton" unlike "name",  is always displayed Why?

Thanks again.
Angelo

Eric DE MAULDE wrote
See sreen context variables and visitor sub-variable
http://docs.ofbiz.org/pages/viewpage.action?pageId=4459


Eric

----- Original Message -----
From: "Angelo Matarazzo" <matarazzoangelo@gmail.com>
To: <user@ofbiz.apache.org>
Sent: Sunday, November 09, 2008 10:04 PM
Subject: Questions about form list and use-when


>
> Hi,
> I'm studying use-when tag  in list-forms and I have a few questions:
>
> 1)I would like to do
>
> <field name="name" title="${uiLabelMap.CommonName} "
> use-when="name.equals("Jack")">
> <display also-hidden="true" description="${name}" />
> </field>
> But there isn't  variable "name" in the context and so use-when doesn't
> work.
> How can I display the specific value of "name" only if it is Jack?
>
> 2)Also
>
> <form name="ListName" type="multi" >
> .
> .
><actions>
> <set field="contextVariable" value="commonValue"/>
> .<actions/>
> .
> .
> <field use-when="contextVariablename.equals(&quot;commonValue&quot;)"
> name="name">
> <display />
> </field>
>
> <field name="submitButton" title="${uiLabelMap.CommonRemove}--&gt;"
> use-when="contextVariablename.equals("commonValue")">
> <submit button-type="button" />
> </field>
>
> The field "submitButton" unlike "name",  is always displayed Why?
>
>
> Thank you for your time.
>
> --
> View this message in context:
> http://www.nabble.com/Questions-about-form-list-and-use-when-tp20410825p20410825.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>