Maybe I didn't make myself clear. We know, if we add a field in the entity, it will show up in the service and the form automatically. But in my projects, we add NOT a field in the entity, but a VALUE. >From the view of database, we just add a record in the table, not a field.
It's totally different. -----Original Message----- From: David E Jones [mailto:[email protected]] Sent: 2009年2月17日 9:39 To: [email protected] Subject: Re: Tricky! About fields in the form Yes. Look at the entities, services, and forms in the Example application (and in fact most in OFBiz). The pattern we usually use is that services are derived from entities (both defs and implementation), and forms (ie form fields) are derived from services. So, if you add a field to the entity it will show up in the service and the form. If you haven't already, you should check out the framework introduction videos, which explain this and other patterns: http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams -David On Feb 16, 2009, at 6:29 PM, Jack Liu wrote: > Hi, All > In my project, there are many protocols to set up. > For every protocol, it has many attributes. > All these protocols have been divided into several types according to > their usage. > > For example > A type has attributes: ChlUrl, SupportedCharsets, ServerID > B type has attributes: InClientPull > C type has attributes: ChlUrl, SMRCustomerType, GMDChargingCurrency, > SupportedCharsets, ServerID > > <form name="A" type="single" > target="createProtocolAttribute?protocolid=${id}"> > <field name="ChlUrl"><text/></field> > <field name="SupportedCharsets"><text/></field> > <field name="ServerID"><text/></field> > <field name="submitButton" title="Add Protocol"> > <submit button-type="button"/> > </field> > </form> > <form name="B" type="single" > target="createProtocolAttribute?protocolid=${id}"> > <field name="InClientPull"><text/></field> > <field name="submitButton" title="Add Protocol"> > <submit button-type="button"/> > </field> > </form> > <form name="C" type="single" > target="createProtocolAttribute?protocolid=${id}"> > <field name="ChlUrl"><text/></field> > <field name="SMRCustomerType"><text/></field> > <field name="GMDChargingCurrency"><text/></field> > <field name="SupportedCharsets"><text/></field> > <field name="ServerID"><text/></field> > <field name="submitButton" title="Add Protocol"> > <submit button-type="button"/> > </field> > </form> > > When setting up a protocol in a web page, first choose a type from > drop-down list, the web page show attributes relating to its type. > After filling in the attributes' value, submit the form and save all > these attribute-value pairs in the table protocolAttribute below. > > services.xml > <service name=" createProtocolAttribute " engine="java" > location="com.xian.cmb.CmbServices" invoke="createProtocolAttribute"> > <attribute name="ChlUrl" mode="IN" type="String" > optional="true" /> > <attribute name="SupportedCharsets" mode="IN" > type="String" optional="true" /> > <attribute name="ServerID" mode="IN" type="String" > optional="true" /> > <attribute name="InClientPull" mode="IN" type="String" > optional="true" /> > <attribute name="SMRCustomerType" mode="IN" > type="String" optional="true" /> > <attribute name="GMDChargingCurrency" mode="IN" > type="String" optional="true" /> > </service> > > > Tables: > protocol: protocolid, protocolName. > protocolAttribute: id, protocolid, attribute, value. > > > With the progress of technology, the number of every protocol's > attributes is increasing. > So we need to modify the forms in the screens to add new fields and > services.xml file to add mode IN attributes, and java code to save > newly > added attribute-value pairs. > Can OFBiz have solutions to deal with the CHANGE and When adding an > attribute, we needn't modify the form, services.xml and java source > code? > > > > > Best Regards, > > Jack Liu >
