Hi Michael, having a lookup that returns multiple selected values in a field is a general enough task that should be addressed with a general purpose tool. It could be a different decorator from which exten the lookup decorator (so for example we could have a multiLookupDecorator in addition to the actual lookupDecorator).
In one project I have already done this, I need some time to see if this was implemented in an enough general way to be reused. -Bruno 2010/1/9 Michael Xu (xudong) <[email protected]>: > hi Bruno, > > However, such improvement needs to change the form widget schema and the > render. I proposed another way to make form widget more flexible. For your > reference, I pasted it here: > >>>>> > > hi all, > > In ofbiz form, we can use lookup controller for fields which link to > entities. But the lookup controller only support to return single value. How > to implement a multiple lookup? > > Looking into source code, it seems that we have to extend a new controller > in form widget schema and implement it in the form render. Is it a correct > way to go? > > BTW: In my opinion, it is not flexible to extend form widget in current > design. (correct me if I am wrong). Let's take one example. > > <form name="AssignGlAccount" type="single" > target="createGlAccountOrganization" title="" default-map-name="account" > header-row-style="header-row" default-table-style="basic-table"> > <field name="glAccountId"> > <drop-down> > <entity-options entity-name="GlAccount" > description="${accountCode} - ${accountName} [${glAccountId}]"> > <entity-order-by field-name="accountCode"/> > </entity-options> > </drop-down> > </field> > ... > </form> > > Here, we have to use <drop-down> tag to tell system to render a HTML > drop-down component. But what if a customized field? Then do we have to > change form widget schema for that field? And then add the render logic in > the long switch-cases? > > Maybe we can refactor the design, like this: > > <form name="AssignGlAccount" type="single" > target="createGlAccountOrganization" title="" default-map-name="account" > header-row-style="header-row" default-table-style="basic-table"> > <field name="glAccountId"> > <controller name="drop-down"> > <!-- > for new non-standard controller, we can define like this: > <controller name="org.ofbiz.FancyDropDown"> > --> > <param key="entity-name" value="GLAccount"/> > <param key="description" value="...."/> > <param key="entity-order-by" value="accountCode"/> > <!-- > for new non-standard controller, we can define new > parameters > --> > </field> > ... > </form> > > with the new design, then we don't need to break the schema and change the > core code of render logic. Instead, we just need to implement a new > controller from a predefined controller interface. And then we can reuse it > in all forms. > > (In here, due to the limitation of current form widget, we have to give up > form and use FTL directly.) > > -- > Regards, > Michael Xu (xudong) > www.wizitsoft.com | Office: (8610) 6267 0615 ext 806 | Mobile: (86) 135 0135 > 9807 | Fax: (8610) 62670096 > > > On Sat, Jan 9, 2010 at 1:17 AM, Bruno Busco <[email protected]> wrote: > >> Having a field widget property that renders to the title property to >> the input field seems much simpler. >> -Bruno >> >> 2010/1/8 Parimal Gain <[email protected]>: >> > Hello Raj, >> > >> > One way to do this might be call javascript method from the form field >> > and write necessary code that you want to display as tooltip within the >> > method. >> > You can call javascript method by following manner : >> > >> > <field name="abc" event="onmouseover" >> > action="javascript:methodName();"/> >> > >> > Regards >> > -- >> > Parimal Gain >> > >> > >> > On Fri, 2010-01-08 at 13:50 +0530, Raj Saini wrote: >> >> Hi, >> >> >> >> I want to show the tool tip for a form field on mouse over. All examples >> >> Various forms I found in OFBiz, render the tool tip as hint label. Is it >> >> possible to show the tool tip on mouse over on a form field? >> >> >> >> Thanks, >> >> >> >> Raj >> > >> > >> > >> > >> >
