Re: Question about lookup tag in form widget

Posted by adityasharma on
URL: http://ofbiz.116.s1.nabble.com/Question-about-lookup-tag-in-form-widget-tp4761380p4761382.html

Hi Daors,

Adding to Pawan's answer

Refer macro here
https://github.com/apache/ofbiz-framework/blob/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl#L521

JS code can be found here
https://github.com/apache/ofbiz-framework/blob/trunk/themes/common-theme/webapp/common/js/util/OfbizUtil.js#L208

HTH

Thanks and Regards,
Aditya Sharma


On Thu, Nov 5, 2020 at 1:11 PM Pawan Verma <[hidden email]>
wrote:

> Hi Daors,
>
> I'm sorry due to time constrain I am providing a quick answer.
>
> The lookup field is rendered from renderLookupField macro which you can
> find in HtmlFormMacroLibrary.ftl file.
>
> HTH!
> --
> Thanks & Regards
> Pawan Verma
> Technical Consultant
> *HotWax Systems*
> *Enterprise open source experts*
> http://www.hotwaxsystems.com
>
>
> On Thu, Nov 5, 2020 at 12:56 PM Daors <[hidden email]> wrote:
>
> > Hello OFBiz community!
> >
> > I started to check the execution on how a find form works and saw that in
> > a field
> > there is the lookup tag and has a target:
> >
> > <field position="2" name="partyIdTo" parameter-name="partyId"
> > required-field="true"><lookup
> target-form-name="LookupPartyName"/></field>
> >
> > When I check this field in web browser with inspect element there are so
> > many attributes like:
> >         name="partyId"
> >         size="25"
> >         id="0_lookupId_NewSalesInvoice_partyIdTo"
> >         data-lookup-ajax-enabled="true"
> >         data-lookup-presentation="layer"
> >         data-lookup-request-url="LookupPartyName"
> >         data-lookup-form-name="NewSalesInvoice"
> >         data-lookup-optional-target=""
> >         data-lookup-width="640"
> >         data-lookup-height="500"
> >         data-lookup-position="topleft"
> >         data-lookup-modal="true"
> >         data-lookup-show-description="true"
> >         data-lookup-default-minlength="2"
> >         data-lookup-default-delay="300"
> >         data-lookup-args=""
> >         autocomplete="off"
> >         data-lookup-ajax= url="NewSalesInvoice_partyIdTo,
> >
> https://localhost:8443/ar/control/LookupPartyName;jsessionid=188FCECFADC720E660C03A5D3462E5F5.jvm1,ajaxLookup=Y&amp;searchValueFieldName=partyId
> "
> >
> >
> > My question is does lookup target adds these attributes automatically?
> and
> > if so how the process of the ajax call is being made, like where is the
> > jquery function that is calling this url, if you could help me explaining
> > this process it would mean so much to me.
> >
> > Thank you so much for your time,
> > Best regards,
> > Daors
> >
>