You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Daors <da...@gmail.com> on 2020/11/05 07:26:00 UTC

Question about lookup tag in form widget

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

Re: Question about lookup tag in form widget

Posted by Daors Islami <da...@gmail.com>.
Hi Aditya and Pawan,

Thank you so much for the answers, I really appreciate it!
I will now look into them,

Best Regards,
Daors

On Thu, Nov 5, 2020 at 8:44 AM Aditya Sharma <ad...@apache.org>
wrote:

> 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 <pa...@hotwaxsystems.com>
> 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 <da...@gmail.com> 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
> > >
> >
>

Re: Question about lookup tag in form widget

Posted by Aditya Sharma <ad...@apache.org>.
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 <pa...@hotwaxsystems.com>
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 <da...@gmail.com> 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
> >
>

Re: Question about lookup tag in form widget

Posted by Pawan Verma <pa...@hotwaxsystems.com>.
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 <da...@gmail.com> 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
>