populate the drop down field with values from another field

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

populate the drop down field with values from another field

Deepika1234
I have created a new entity in entitymodel.xml having the following fields:-

<entity entity-name="Weightageaccord"
            package-name="org.ofbiz.product.product"
            title="Weightage Entity">
      <field name="TypeId"  type="id-ne"></field>
      <field name="TypeName" type="name"></field>
       <field name="Weightage" type="numeric"></field>
      <prim-key field="TypeId"/>
     </entity>

In Shipping Forms.xml i have given the following
<form name="Search" type="single" target="processForm" title=""
        header-row-style="header-row" default-table-style="basic-table">
       
        <field name="TypeId"><text/></field>
        <field name="brandName"  title="Merchant Name" >
       
                <drop-down allow-empty="false"   widget-style="length1">
                <entity-options entity-name="Product" description="${brandName}">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>     
       <field name="Weightage"><text/></field>
     
         
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>


What i want is that i want tht field TypeName to be populated with values of brandName of product entity.When the user chooses a brandName from the dropdown it will get saved in the typeName of Weightageaccord entity along with TypeId and Weightage.

Thus, my question is is it possible to populate the drop down field with values from another field , so that the end user can choose values from it and submit it, which will be stored in the db along with the other fields in the table .Please help me
Reply | Threaded
Open this post in threaded view
|

Re: populate the drop down field with values from another field

Ravindra Mandre-2
Hi,
please read comment inline

On Wed, Jul 21, 2010 at 3:56 PM, Deepika1234 <[hidden email]> wrote:

>
> I have created a new entity in entitymodel.xml having the following
> fields:-
>
> <entity entity-name="Weightageaccord"
>            package-name="org.ofbiz.product.product"
>            title="Weightage Entity">
>      <field name="TypeId"  type="id-ne"></field>
>      <field name="TypeName" type="name"></field>
>       <field name="Weightage" type="numeric"></field>
>      <prim-key field="TypeId"/>
>     </entity>
>
> In Shipping Forms.xml i have given the following
> <form name="Search" type="single" target="processForm" title=""
>        header-row-style="header-row" default-table-style="basic-table">
>
>        <field name="TypeId"><text/></field>
>        <field name="brandName"


give a try to this as  parameter-name="typeName".
after the field name.

Ravindra Mandre



> title="Merchant Name" >
>
>                <drop-down allow-empty="false"   widget-style="length1">
>                <entity-options entity-name="Product"
> description="${brandName}">
>                    <entity-order-by field-name="description"/>
>                </entity-options>
>            </drop-down>
>        </field>
>       <field name="Weightage"><text/></field>
>
>
>        <field name="submitButton" title="${uiLabelMap.CommonSubmit}"
> widget-style="smallSubmit"><submit button-type="button"/></field>
>    </form>
>
>
> What i want is that i want tht field TypeName to be populated with values
> of
> brandName of product entity.When the user chooses a brandName from the
> dropdown it will get saved in the typeName of Weightageaccord entity along
> with TypeId and Weightage.
>
> Thus, my question is is it possible to populate the drop down field with
> values from another field , so that the end user can choose values from it
> and submit it, which will be stored in the db along with the other fields
> in
> the table .Please help me
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/populate-the-drop-down-field-with-values-from-another-field-tp2296885p2296885.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: populate the drop down field with values from another field

madhu
how to get the values into the dropdown with some 'where' condition.
ex:
<entity entity-name="Weightageaccord"
                      title="Weightage Entity">
      <field name="TypeId"  type="id-ne"></field>
      <field name="TypeName" type="name"></field>
 <field name="Weightage" type="numeric"></field>
          <prim-key field="TypeId"/>
     </entity>

here i want to load typename into the dropdown where Weightage is null. how to mention this where condition in

<drop-down allow-empty="false">
<entity-options description="${TypeName}"  
key-field-name="TypeName" entity-name="Weightageaccord">                                                                               
</entity-options>
</drop-down>
Reply | Threaded
Open this post in threaded view
|

Re: populate the drop down field with values from another field

Ankush Upadhyay
Hello,

Use entity-constraint tag
like
<drop-down allow-empty="false">
<entity-options description="${TypeName}"
key-field-name="TypeName"
entity-name="Weightageaccord">><entity-constraint name="Weightage"
value="null"/>
</entity-options>
</drop-down>

Or

In entity-constraint tag there is another attribute ignore-if-null.
initialize it by false.

On 05/31/2012 02:37 PM, madhu wrote:

> how to get the values into the dropdown with some 'where' condition.
> ex:
> <entity entity-name="Weightageaccord"
>                        title="Weightage Entity">
>        <field name="TypeId"  type="id-ne"></field>
>        <field name="TypeName" type="name"></field>
>   <field name="Weightage" type="numeric"></field>
>            <prim-key field="TypeId"/>
>       </entity>
>
> here i want to load typename into the dropdown where Weightage is null. how
> to mention this where condition in
>
> <drop-down allow-empty="false">
> <entity-options description="${TypeName}"
> key-field-name="TypeName" entity-name="Weightageaccord">
> </entity-options>
> </drop-down>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/populate-the-drop-down-field-with-values-from-another-field-tp2296885p4632844.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

--
Thanks&  Regards
Ankush Upadhyay
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: populate the drop down field with values from another field

madhu
thank you ankush

In entity-constraint tag there is another attribute ignore-if-null.
initialize it by false.

is working fine.