Hey Foo, If you have those automatically added field in an entity then you can make use of auto-attributes, pk/nonpk marking optional as true, in that case you'll get the values if the values are there, otherwise null., If you need to bring in empty string then you certainly have to intercept data posting, i.e. java event that you mentioned you'll be hitting, also with service mutli, you can actually call a sub-service that will be called for multiple
fields for e.g. if you have something of sorts checqueno1 ,chequeno2, etc. If its just simply gonna be chequeno ,then proceeding with auto-attributes will be favorable and later on in the back-end i.e. the java part you can actually call a custom validator cum transformer that will validate the values and if null can transform it to the default format, one more way would be giving default values in the form itself, in case you don't want the null values to reach to the sever side and it to be a couple of empty strings. Hope it helps. Regards Prince ________________________________ From: Foo Shyn Chung <ipoh...@gmail.com> To: user@ofbiz.apache.org Sent: Friday, February 17, 2012 8:58 AM Subject: Re: Defining attribute in servces.xml Thanx for pointing me to there. It is not exactly what i needed as i need complete the creation within one service call. However being in the order module i manage to find that the shopping cart has similar things that what i needed to code for. It seems like by using Java events i would be able to filter all the parameters before i call the service. Will give it a shot. Thanx again for the prompt reply! FooShyn On Fri, Feb 17, 2012 at 10:53 AM, Integrin Solutions < info.integ...@gmail.com> wrote: > 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 <ipoh...@gmail.com> 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 > > >