conditional form addition in the screen

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

conditional form addition in the screen

prasanthi_ofbiz
Hi,
    I want to include a form into one ofbiz screen based on some condition.
Please me help me out..
Ex: My Screen

<screen name="EditFinAccountTrans">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditFinAccountTrans"/>
                <set field="tabButtonItem" value="EditFinAccountTrans"/>
                <set field="finAccountId" from-field="parameters.finAccountId"/>
                <entity-one entity-name="FinAccount" value-field="finAccount"/>
                <set field="finAccountTransId" from-field="parameters.finAccountTransId"/>
               
            </actions>
            <widgets>
                <decorator-screen name="CommonFinAccountDecorator" location="${parameters.finAccountDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="FinAccountTransPanel" title="${uiLabelMap.PageTitleEditFinAccountTrans} ${uiLabelMap.CommonFor} ${finAccount.finAccountName} [${finAccountId}]" collapsible="true">
                            <include-form name="AddFinAccountTrans" location="component://accounting/widget/FinAccountForms.xml"/>
                        </screenlet>
                        <include-form name="ListFinAccountTransactions" location="component://accounting/widget/FinAccountForms.xml"/>                       
                   <include-form name="CreateAcctgTrans1" location="component://accounting/widget/GlForms.xml"/>                         
                    </decorator-section>
                </decorator-screen>
            </widgets>
           
        </section>
    </screen>


Requirement:
if parameters.finAccountTransId has some value i.e: >0 then i need to include the form which is in bold, other wise i don't want to include/show that form in the screen...
Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

Atul Vani
hi Prasanthi,

how about you use it like this:-

<screen name="...">
        <section>  
            <condition>...</condition>
            <actions>...</actions>
            <widget></widget>
            <fail-widget>
                <section>... ... ...</section>
            </failwidget>
         </section>
</screen>

prasanthi_ofbiz wrote:

> Hi,
>     I want to include a form into one ofbiz screen based on some condition.
> Please me help me out..
> Ex: My Screen
>
> <screen name="EditFinAccountTrans">
>         <section>
>             <actions>
>                 <set field="titleProperty"
> value="PageTitleEditFinAccountTrans"/>
>                 <set field="tabButtonItem" value="EditFinAccountTrans"/>
>                 <set field="finAccountId"
> from-field="parameters.finAccountId"/>
>                 <entity-one entity-name="FinAccount"
> value-field="finAccount"/>
>                 <set field="finAccountTransId"
> from-field="parameters.finAccountTransId"/>
>                
>             </actions>
>             <widgets>
>                 <decorator-screen name="CommonFinAccountDecorator"
> location="${parameters.finAccountDecoratorLocation}">
>                     <decorator-section name="body">
>                         <screenlet id="FinAccountTransPanel"
> title="${uiLabelMap.PageTitleEditFinAccountTrans} ${uiLabelMap.CommonFor}
> ${finAccount.finAccountName} [${finAccountId}]" collapsible="true">
>                             <include-form name="AddFinAccountTrans"
> location="component://accounting/widget/FinAccountForms.xml"/>
>                         </screenlet>
>                         <include-form name="ListFinAccountTransactions"
> location="component://accounting/widget/FinAccountForms.xml"/>                        
>                    <include-form name="CreateAcctgTrans1"
> location="component://accounting/widget/GlForms.xml"/>                        
>                     </decorator-section>
>                 </decorator-screen>
>             </widgets>
>            
>         </section>
>     </screen>
>
>
> Requirement:
> if parameters.finAccountTransId has some value i.e: >0 then i need to
> include the form which is in bold, other wise i don't want to include/show
> that form in the screen...
>  


--
Thanks & Regards
Atul Vani
Jr. Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/

Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

prasanthi_ofbiz
Hi Atul Vani ,
        Thaks for your reply. I applied same thing but no use... Check the below code




<screen name="EditFinAccountTrans">
        <section>
        <condition>       
        <if-compare field="finAccountTransId" operator="equals" value=" "/>
        </condition>
       
            <actions>
                <set field="titleProperty" value="PageTitleEditFinAccountTrans"/>
                <set field="tabButtonItem" value="EditFinAccountTrans"/>
                <set field="finAccountId" from-field="parameters.finAccountId"/>
                <set field="firstVisit" value=" "/>
                 <set field="secondVisit" value=" "/>
                <entity-one entity-name="FinAccount" value-field="finAccount"/>
                <set field="finAccountTransId" from-field="parameters.finAccountTransId"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFinAccountDecorator" location="${parameters.finAccountDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="FinAccountTransPanel" title="${uiLabelMap.PageTitleEditFinAccountTrans} ${uiLabelMap.CommonFor} ${finAccount.finAccountName} [${finAccountId}]" collapsible="true">
                            <include-form name="AddFinAccountTrans" location="component://accounting/widget/FinAccountForms.xml"/>
                        </screenlet>
                        <include-form name="ListFinAccountTransactions" location="component://accounting/widget/FinAccountForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>           
            <fail-widgets>
            <decorator-screen name="CommonFinAccountDecorator" location="${parameters.finAccountDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="FinAccountTransPanel" title="${uiLabelMap.PageTitleEditFinAccountTrans} ${uiLabelMap.CommonFor} ${finAccount.finAccountName} [${finAccountId}]" collapsible="true">
                            <include-form name="AddFinAccountTrans" location="component://accounting/widget/FinAccountForms.xml"/>
                        </screenlet>
                        <include-form name="ListFinAccountTransactions" location="component://accounting/widget/FinAccountForms.xml"/>
                        <include-form name="CreateAcctgTrans1" location="component://accounting/widget/GlForms.xml"/>
                    </decorator-section>
                </decorator-screen>           
            </fail-widgets>
             
        </section>
    </screen>


Code written in bold is the extra code written by me. Before form submission finAccountTransId  value is null, after submitting form its generating finAccountTransId value , so before submission CreateAcctgTrans1  form should not be included . But in both cases the form is not included. Please help me where i did the mistake.
Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

Atul Vani
In reply to this post by prasanthi_ofbiz
hi Prasanthi,

the code looks right,

just one thing (i am not sure if it will make any difference or not, never tried it your way)
why don't you try using <if-empty ... /> instead of <if-compare ... />

Thanks & Regards
Atul Vani

----- Original Message -----
From: "prasanthi_ofbiz" <[hidden email]>
To: [hidden email]
Sent: Wednesday, May 12, 2010 8:53:09 PM GMT +05:30 Chennai, Kolkata, Mumbai, New Delhi
Subject: Re: conditional form addition in the screen


Hi Atul Vani ,
        Thaks for your reply. I applied same thing but no use... Check the
below code




<screen name="EditFinAccountTrans">
        <section>
        <condition>        
        <if-compare field="finAccountTransId" operator="equals" value="
"/>
        </condition>        
            <actions>
                <set field="titleProperty"
value="PageTitleEditFinAccountTrans"/>
                <set field="tabButtonItem" value="EditFinAccountTrans"/>
                <set field="finAccountId"
from-field="parameters.finAccountId"/>
                <set field="firstVisit" value=" "/>
                 <set field="secondVisit" value=" "/>
                <entity-one entity-name="FinAccount"
value-field="finAccount"/>
                <set field="finAccountTransId"
from-field="parameters.finAccountTransId"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFinAccountDecorator"
location="${parameters.finAccountDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="FinAccountTransPanel"
title="${uiLabelMap.PageTitleEditFinAccountTrans} ${uiLabelMap.CommonFor}
${finAccount.finAccountName} [${finAccountId}]" collapsible="true">
                            <include-form name="AddFinAccountTrans"
location="component://accounting/widget/FinAccountForms.xml"/>
                        </screenlet>
                        <include-form name="ListFinAccountTransactions"
location="component://accounting/widget/FinAccountForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>            
            <fail-widgets>
            <decorator-screen name="CommonFinAccountDecorator"
location="${parameters.finAccountDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="FinAccountTransPanel"
title="${uiLabelMap.PageTitleEditFinAccountTrans} ${uiLabelMap.CommonFor}
${finAccount.finAccountName} [${finAccountId}]" collapsible="true">
                            <include-form name="AddFinAccountTrans"
location="component://accounting/widget/FinAccountForms.xml"/>
                        </screenlet>
                        <include-form name="ListFinAccountTransactions"
location="component://accounting/widget/FinAccountForms.xml"/>
                        <include-form name="CreateAcctgTrans1"
location="component://accounting/widget/GlForms.xml"/>
                    </decorator-section>
                </decorator-screen>            
            </fail-widgets>            
        </section>
    </screen>


Code written in bold is the extra code written by me. Before form submission
finAccountTransId  value is null, after submitting form its generating
finAccountTransId value , so before submission CreateAcctgTrans1  form
should not be included . But in both cases the form is not included. Please
help me where i did the mistake.
--
View this message in context: http://ofbiz.135035.n4.nabble.com/conditional-form-addition-in-the-screen-tp2195999p2196221.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

Akash Jain-4
In reply to this post by prasanthi_ofbiz
Hello Prasanthi,

do correction in your code, inline

prasanthi_ofbiz wrote:

> Hi Atul Vani ,
>         Thaks for your reply. I applied same thing but no use... Check the
> below code
>
>
>
>
> <screen name="EditFinAccountTrans">
>         <section>
>         <condition>        
>         <if-compare field="finAccountTransId" operator="equals" value="
> "/>
>  
field should be, parameters.finAccountTransId

>         </condition>        
>             <actions>
>                 <set field="titleProperty"
> value="PageTitleEditFinAccountTrans"/>
>                 <set field="tabButtonItem" value="EditFinAccountTrans"/>
>                 <set field="finAccountId"
> from-field="parameters.finAccountId"/>
>                 <set field="firstVisit" value=" "/>
>                  <set field="secondVisit" value=" "/>
>                 <entity-one entity-name="FinAccount"
> value-field="finAccount"/>
>                 <set field="finAccountTransId"
> from-field="parameters.finAccountTransId"/>
>             </actions>
>             <widgets>
>                 <decorator-screen name="CommonFinAccountDecorator"
> location="${parameters.finAccountDecoratorLocation}">
>                     <decorator-section name="body">
>                         <screenlet id="FinAccountTransPanel"
> title="${uiLabelMap.PageTitleEditFinAccountTrans} ${uiLabelMap.CommonFor}
> ${finAccount.finAccountName} [${finAccountId}]" collapsible="true">
>                             <include-form name="AddFinAccountTrans"
> location="component://accounting/widget/FinAccountForms.xml"/>
>                         </screenlet>
>                         <include-form name="ListFinAccountTransactions"
> location="component://accounting/widget/FinAccountForms.xml"/>
>                     </decorator-section>
>                 </decorator-screen>
>             </widgets>            
>             <fail-widgets>
>             <decorator-screen name="CommonFinAccountDecorator"
> location="${parameters.finAccountDecoratorLocation}">
>                     <decorator-section name="body">
>                         <screenlet id="FinAccountTransPanel"
> title="${uiLabelMap.PageTitleEditFinAccountTrans} ${uiLabelMap.CommonFor}
> ${finAccount.finAccountName} [${finAccountId}]" collapsible="true">
>                             <include-form name="AddFinAccountTrans"
> location="component://accounting/widget/FinAccountForms.xml"/>
>                         </screenlet>
>                         <include-form name="ListFinAccountTransactions"
> location="component://accounting/widget/FinAccountForms.xml"/>
>                         <include-form name="CreateAcctgTrans1"
> location="component://accounting/widget/GlForms.xml"/>
>                     </decorator-section>
>                 </decorator-screen>            
>             </fail-widgets>            
>         </section>
>     </screen>
>
>
> Code written in bold is the extra code written by me. Before form submission
> finAccountTransId  value is null, after submitting form its generating
> finAccountTransId value , so before submission CreateAcctgTrans1  form
> should not be included . But in both cases the form is not included. Please
> help me where i did the mistake.
>  

Thanks and Regards
--
Akash Jain
Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

prasanthi_ofbiz
Hi Akash,
          I didn't get you. can u pls explain
Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

Akash Jain-4
Hello Prasanthi,

use, <if-compare field="parameters.finAccountTransId" operator="equals"
value=" "/> instead of <if-compare field="finAccountTransId"
operator="equals" value=" "/>

Thanks and Regards
--
Akash

prasanthi_ofbiz wrote:
> Hi Akash,
>           I didn't get you. can u pls explain
>  

Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

Arpit Singh Pandya-2
In reply to this post by prasanthi_ofbiz
hey prasanthi,
instead of <if-compare field="finAccountTransId"  try -->> <if-compare
field="parameters.finAccountTransId"

HTH

--
Arpit Singh Pandya
Direct : +91-982-693-2255

On Thu, May 13, 2010 at 10:40 AM, prasanthi_ofbiz <
[hidden email]> wrote:

>
> Hi Akash,
>          I didn't get you. can u pls explain
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/conditional-form-addition-in-the-screen-tp2195999p2197152.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

Akash Jain-4
In reply to this post by prasanthi_ofbiz
Hello Prasanthi,

If you just want to check empty field then you can also use, <if-empty
field="parameters.finAccountTransId"/> inside condition tag. like,

<condition>
    <if-empty field="parameters.finAccountTransId"/>
</condition>

HTH

Thanks and Regards
--
Akash

prasanthi_ofbiz wrote:
> Hi Akash,
>           I didn't get you. can u pls explain
>  

Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

prasanthi_ofbiz
Hi Akash,
       I tried same thing already but no use. Its always including the CreateAcctgTrans1 form

Thanks & Regards
Prasanthi
Reply | Threaded
Open this post in threaded view
|

Re: conditional form addition in the screen

prasanthi_ofbiz
In reply to this post by Akash Jain-4
Hi Akash,
         Its working now. I have written condition <if-empty field="parameters.finAccountTransId"/>   instead of <if-empty field="finAccountTransId"/>   then its working. Thank you .
Regards,
Prasanthi