FooShyn -
If each section represents a repeated set of fields, try using the
service-multi handler i.e. <handler name="service-multi" type="request"
class="org.ofbiz.webapp.event.ServiceMultiEventHandler"/>
Refer to
/erp-food_industry/applications/order/webapp/ordermgr/WEB-INF/controller.xml;
how this is being used,
i.e.
<request-map uri="assignItemToShipGroups">
<security https="true" auth="true"/>
<event type="service-multi" invoke="assignItemShipGroup"/>
<response name="success" type="view" value="SetItemShipGroups"/>
<response name="error" type="view" value="SetItemShipGroups"/>
</request-map>
Basically the ServiceMultiHanlder decomposes the request into multiple
service calls;
Hope this helps.
- Sakthi
On Thu, Feb 16, 2012 at 8:50 PM, Foo Shyn Chung <[email protected]> wrote:
> Hi all,
>
> I'm encountering a problem whereby i have fields in a form that has
> variable naming in the name attributes that need to pass into a service,
> but can't do so because i can't define it in the services.xml
>
> The scenario is that, i have a major form, and there's this sub section of
> fields that are added to it through ajax. These fields represent one set of
> data and they are not compulsory, meaning some of the fields may be empty.
> Example, in the added fields, i have a field of ID, amount and cheque no.
> The user can choose to fill in ID and amount but not the cheque no.
>
> At first i name all these fields using the same name, and i pass them to
> the service as a List. It works great until i found that if i don't fill in
> the cheque no, the cheque no list will actually be null and not a List with
> an empty string. This is causing me issue to map them correctly in the
> service.
>
> Then i tried to use the old school method, namely having a counter in a
> hidden field and have them named with a suffix that representing the
> counter. And then i found that i can't dynamically define the attributes in
> the services.xml
>
> Does anyone encounter such issue before? Any advise or help?
>
> Thanx
> FooShyn
>