select box error

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

select box error

Pal Infocom Technologies-2
I want to add product category id into primaryProductCategoryId field.
i have added a select box  in the form that shows the product creation screen using following code:

<field name="productCategoryId" title="${uiLabelMap.ProductPrimaryCategory}" widget-style="selectBox">
            <drop-down allow-empty="true">
                <entity-options entity-name="ProductCategory"  description="${categoryName} [{productCategoryId}]">
                       <entity-order-by field-name="categoryName"/>
                </entity-options>
            </drop-down>
        </field>

and following line in simple method that create the product using map newEntity.
 <set field="newEntity.primaryProductCategoryId" from-field="parameters.productCategoryId"  />
it shows the values in select box but doesn't insert the selected value in the product. it returns null
where am i wrong?
please provide help..
Reply | Threaded
Open this post in threaded view
|

Re: select box error

Jacopo Cappellato
Amit,

please post this kind of messages to the user list (they are not about
developing the official OFBiz).

The correct form field definition should be:

<field name="primaryProductCategoryId"
title="${uiLabelMap.ProductPrimaryCategory}">
   <drop-down allow-empty="true">
     <entity-options entity-name="ProductCategory"
description="${categoryName} [{productCategoryId}]"
key-field-name="productCategoryId">
       <entity-order-by field-name="categoryName"/>
     </entity-options>
   </drop-down>
</field>

With this, no changes to the service will be needed.

Jacopo

amit charaya wrote:

> I want to add product category id into primaryProductCategoryId field.
> i have added a select box  in the form that shows the product creation
> screen using following code:
>
> <field name="productCategoryId" title="${uiLabelMap.ProductPrimaryCategory}"
> widget-style="selectBox">
>             <drop-down allow-empty="true">
>                 <entity-options entity-name="ProductCategory"
> description="${categoryName} [{productCategoryId}]">
>                        <entity-order-by field-name="categoryName"/>
>                 </entity-options>
>             </drop-down>
>         </field>
>
> and following line in simple method that create the product using map
> newEntity.
>  <set field="newEntity.primaryProductCategoryId"
> from-field="parameters.productCategoryId"  />
> it shows the values in select box but doesn't insert the selected value in
> the product. it returns null
> where am i wrong?
> please provide help..
>

Reply | Threaded
Open this post in threaded view
|

Re: select box error

Vikash Anand-2
In reply to this post by Pal Infocom Technologies-2
Dear Amit;
          Jacopo is right. In ofbiz if you want to add new fields you can
add it in entitymodel.xml and it will be loaded in database. You do not need
to make any changes in services as it returns values using map.

Using code by Jacopo you can show data in your ftl file.

Thanks and Regards;
Vikash Anand.

On 6/27/07, amit charaya <[hidden email]> wrote:

>
>
> I want to add product category id into primaryProductCategoryId field.
> i have added a select box  in the form that shows the product creation
> screen using following code:
>
> <field name="productCategoryId" title="${uiLabelMap.ProductPrimaryCategory
> }"
> widget-style="selectBox">
>             <drop-down allow-empty="true">
>                 <entity-options entity-name="ProductCategory"
> description="${categoryName} [{productCategoryId}]">
>                        <entity-order-by field-name="categoryName"/>
>                 </entity-options>
>             </drop-down>
>         </field>
>
> and following line in simple method that create the product using map
> newEntity.
> <set field="newEntity.primaryProductCategoryId"
> from-field="parameters.productCategoryId"  />
> it shows the values in select box but doesn't insert the selected value in
> the product. it returns null
> where am i wrong?
> please provide help..
>
> --
> View this message in context:
> http://www.nabble.com/select-box-error-tf3987696.html#a11322494
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: select box error

Jacques Le Roux
Administrator
In reply to this post by Pal Infocom Technologies-2
Please *don't* send this type of message to the dev ML.

The dev ML is intended to *developing* OFBiz not to *use* it !

Thanks

Jacques

De : "amit charaya" <[hidden email]>

>
> I want to add product category id into primaryProductCategoryId field.
> i have added a select box  in the form that shows the product creation
> screen using following code:
>
> <field name="productCategoryId" title="${uiLabelMap.ProductPrimaryCategory}"
> widget-style="selectBox">
>             <drop-down allow-empty="true">
>                 <entity-options entity-name="ProductCategory"
> description="${categoryName} [{productCategoryId}]">
>                        <entity-order-by field-name="categoryName"/>
>                 </entity-options>
>             </drop-down>
>         </field>
>
> and following line in simple method that create the product using map
> newEntity.
>  <set field="newEntity.primaryProductCategoryId"
> from-field="parameters.productCategoryId"  />
> it shows the values in select box but doesn't insert the selected value in
> the product. it returns null
> where am i wrong?
> please provide help..
>
> --
> View this message in context: http://www.nabble.com/select-box-error-tf3987696.html#a11322494
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.