Using Form lookup attribute "target-parameter"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Form lookup attribute "target-parameter"

James McGill-5
I added a field to the Inventory Item lookup page to allow searching by
LocationSeqId.

So in
product/webapp/facility/facility/FacilityForms.xml#SearchInventoryItemsParams
I have this:

        <field name="locationSeqId" title="Location">
            <lookup target-form-name="LookupFacilityLocation"
target-parameter="facilityId"/>
        </field>

The trouble is, the javascript for call_fieldlookup2 turns this into a query
string like:
http://ofbiz/facility/control/LookupFacilityLocation?id=undefined&parm0=myFacilityId

and I think we want something like:

https://ofbiz/facility/control/LookupFacilityLocation?facilityId=myFacilityId


Can I make that happen within the Form xsd?


--
James McGill
Phoenix AZ
Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

Jacques Le Roux
Administrator
It seems you are using a revision before r949710, update at least to this to use target-parameter or patch with r946593 if you want
to stay with the revision you are

Jacques

From: "James McGill" <[hidden email]>

>I added a field to the Inventory Item lookup page to allow searching by
> LocationSeqId.
>
> So in
> product/webapp/facility/facility/FacilityForms.xml#SearchInventoryItemsParams
> I have this:
>
>        <field name="locationSeqId" title="Location">
>            <lookup target-form-name="LookupFacilityLocation"
> target-parameter="facilityId"/>
>        </field>
>
> The trouble is, the javascript for call_fieldlookup2 turns this into a query
> string like:
> http://ofbiz/facility/control/LookupFacilityLocation?id=undefined&parm0=myFacilityId
>
> and I think we want something like:
>
> https://ofbiz/facility/control/LookupFacilityLocation?facilityId=myFacilityId
>
>
> Can I make that happen within the Form xsd?
>
>
> --
> James McGill
> Phoenix AZ
>


Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

James McGill-5
On Thu, Jun 3, 2010 at 8:21 PM, Jacques Le Roux <
[hidden email]> wrote:

> It seems you are using a revision before r949710, update at least to this
> to use target-parameter or patch with r946593 if you want to stay with the
> revision you are
>
> Is there a corresponding change to the Form handling as well?   I upgraded
the javascript but I still don't see how the parameter name can be passed.

James
Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

James McGill-5
On Fri, Jun 4, 2010 at 10:24 AM, James McGill <
[hidden email]> wrote:

>
>
> On Thu, Jun 3, 2010 at 8:21 PM, Jacques Le Roux <
> [hidden email]> wrote:
>
>> It seems you are using a revision before r949710, update at least to this
>> to use target-parameter or patch with r946593 if you want to stay with the
>> revision you are
>>
>> Is there a corresponding change to the Form handling as well?   I upgraded
> the javascript but I still don't see how the parameter name can be passed.
>
> James
>

What I'm confused about is this:

function lookup_popup2(view_name) {
  var argString = "";
  if (this.args != null) {
    if (this.args.length > 2) {
      for (var i = 2; i < this.args.length; i++) {
       argString += "&parm" + (i - 2) + "=" + this.args[i];


That never puts "&facilityId=myFacilityId" in there, it only puts literally
&parm0=myFacilityId, so I'm puzzled.


--
James McGill
Phoenix AZ
Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

Jacques Le Roux
Administrator
In reply to this post by James McGill-5
Which Release.revision are you using?

Jacques

From: "James McGill" <[hidden email]>

> On Thu, Jun 3, 2010 at 8:21 PM, Jacques Le Roux <
> [hidden email]> wrote:
>
>> It seems you are using a revision before r949710, update at least to this
>> to use target-parameter or patch with r946593 if you want to stay with the
>> revision you are
>>
>> Is there a corresponding change to the Form handling as well?   I upgraded
> the javascript but I still don't see how the parameter name can be passed.
>
> James
>

Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

David E. Jones-2
In reply to this post by James McGill-5

On Jun 4, 2010, at 11:53 AM, James McGill wrote:

> On Fri, Jun 4, 2010 at 10:24 AM, James McGill <
> [hidden email]> wrote:
>
>>
>>
>> On Thu, Jun 3, 2010 at 8:21 PM, Jacques Le Roux <
>> [hidden email]> wrote:
>>
>>> It seems you are using a revision before r949710, update at least to this
>>> to use target-parameter or patch with r946593 if you want to stay with the
>>> revision you are
>>>
>>> Is there a corresponding change to the Form handling as well?   I upgraded
>> the javascript but I still don't see how the parameter name can be passed.
>>
>> James
>>
>
> What I'm confused about is this:
>
> function lookup_popup2(view_name) {
>  var argString = "";
>  if (this.args != null) {
>    if (this.args.length > 2) {
>      for (var i = 2; i < this.args.length; i++) {
>       argString += "&parm" + (i - 2) + "=" + this.args[i];
>
>
> That never puts "&facilityId=myFacilityId" in there, it only puts literally
> &parm0=myFacilityId, so I'm puzzled.

That's correct, and how it is made to work. Search around for "parm0" and you'll find a few places where it is used.

-David

Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

James McGill-5
In reply to this post by Jacques Le Roux
On Fri, Jun 4, 2010 at 10:59 AM, Jacques Le Roux <
[hidden email]> wrote:

> Which Release.revision are you using?
>

We use 9.04, but for the purpose of the discussion, I'm looking at the
current trunk and r950481 of fieldlookup.js


I was able to solve my problem by appending parameters and values onto the
target-form-name, so I gave up on using target-parameter.



--
James McGill
Phoenix AZ
Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

Jacques Le Roux-2
In reply to this post by James McGill-5
Ha yes, you need to feed facilityId from parm0 in the lookup screen

Something like
<set field="parameters.facilityId " from-field="parameters.parm0" default-value="${parameters.facilityId }"/>

HTH

Jacques


Jacques

From: "James McGill" <[hidden email]>

> On Fri, Jun 4, 2010 at 10:24 AM, James McGill <
> [hidden email]> wrote:
>
>>
>>
>> On Thu, Jun 3, 2010 at 8:21 PM, Jacques Le Roux <
>> [hidden email]> wrote:
>>
>>> It seems you are using a revision before r949710, update at least to this
>>> to use target-parameter or patch with r946593 if you want to stay with the
>>> revision you are
>>>
>>> Is there a corresponding change to the Form handling as well?   I upgraded
>> the javascript but I still don't see how the parameter name can be passed.
>>
>> James
>>
>
> What I'm confused about is this:
>
> function lookup_popup2(view_name) {
>  var argString = "";
>  if (this.args != null) {
>    if (this.args.length > 2) {
>      for (var i = 2; i < this.args.length; i++) {
>       argString += "&parm" + (i - 2) + "=" + this.args[i];
>
>
> That never puts "&facilityId=myFacilityId" in there, it only puts literally
> &parm0=myFacilityId, so I'm puzzled.
>
>
> --
> James McGill
> Phoenix AZ
>

Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

Jacques Le Roux
Administrator
In reply to this post by James McGill-5
Yes, that's another way of doing it. Though in certain cases *you really need* to use target-parameter.
For instance when the value come from another lookup and that value is hidden (see examples for a comment on that if you are
interested)

Jacques

From: "James McGill" <[hidden email]>

> On Fri, Jun 4, 2010 at 10:59 AM, Jacques Le Roux <
> [hidden email]> wrote:
>
>> Which Release.revision are you using?
>>
>
> We use 9.04, but for the purpose of the discussion, I'm looking at the
> current trunk and r950481 of fieldlookup.js
>
>
> I was able to solve my problem by appending parameters and values onto the
> target-form-name, so I gave up on using target-parameter.
>
>
>
> --
> James McGill
> Phoenix AZ
>


Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

James McGill-5
In reply to this post by Jacques Le Roux-2
On Fri, Jun 4, 2010 at 11:51 AM, Jacques Le Roux <
[hidden email]> wrote:

> Ha yes, you need to feed facilityId from parm0 in the lookup screen
>
> Something like
> <set field="parameters.facilityId " from-field="parameters.parm0"
> default-value="${parameters.facilityId }"/>
>
> HTH
>
> Jacques
>
>
>
I don't believe the usage of target-parameter is documented anywhere,
but there is one example in
applications/marketing/widget/ContactListScreens.xml#LookupPreferredContactMech

I thought the idea was that you could use target-parameter to inject named
parameter/values into the query.  It turns out
that you have to change the lookup screen to accept "paramN" parameters
explicitly.

--
James McGill
Phoenix AZ
Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

Jacques Le Roux
Administrator
James McGill wrote:

> On Fri, Jun 4, 2010 at 11:51 AM, Jacques Le Roux <
> [hidden email]> wrote:
>
>> Ha yes, you need to feed facilityId from parm0 in the lookup screen
>>
>> Something like
>> <set field="parameters.facilityId " from-field="parameters.parm0"
>> default-value="${parameters.facilityId }"/>
>>
>> HTH
>>
>> Jacques
>>
>>
>>
> I don't believe the usage of target-parameter is documented anywhere,

Wrong, it is into widget-form.xsd for years. I just improved the documentation at
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?r1=951672&r2=951671&pathrev=951672

> but there is one example in
> applications/marketing/widget/ContactListScreens.xml#LookupPreferredContactMech
>
> I thought the idea was that you could use target-parameter to inject named
> parameter/values into the query.  It turns out
> that you have to change the lookup screen to accept "paramN" parameters
> explicitly.

Yes, I must say I got caught by this one too the 1st time I used it.
We are like spoiled child, no not all is magic in OFBiz (some volunteers work underneath ;o)

Jacques

Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

Jacques Le Roux
Administrator
In reply to this post by James McGill-5
Forwarded

Ok, once more I need to put a tiny link to get through, this begins to bother me

Are links in mail forbidden now? Is it me only (paranoia mode ;o)?

Jacques

Jacques Le Roux wrote:

> James McGill wrote:
>> On Fri, Jun 4, 2010 at 11:51 AM, Jacques Le Roux <
>> [hidden email]> wrote:
>>
>>> Ha yes, you need to feed facilityId from parm0 in the lookup screen
>>>
>>> Something like
>>> <set field="parameters.facilityId " from-field="parameters.parm0"
>>> default-value="${parameters.facilityId }"/>
>>>
>>> HTH
>>>
>>> Jacques
>>>
>>>
>>>
>> I don't believe the usage of target-parameter is documented anywhere,
>
> Wrong, it is into widget-form.xsd for years. I just improved the documentation at
> http://tinyurl.com/3x8opyr
>
>> but there is one example in
>> applications/marketing/widget/ContactListScreens.xml#LookupPreferredContactMech
>>
>> I thought the idea was that you could use target-parameter to inject named
>> parameter/values into the query.  It turns out
>> that you have to change the lookup screen to accept "paramN" parameters
>> explicitly.
>
> Yes, I must say I got caught by this one too the 1st time I used it.
> We are like spoiled child, no not all is magic in OFBiz (some volunteers work underneath ;o)
>
> Jacques

Reply | Threaded
Open this post in threaded view
|

Re: Using Form lookup attribute "target-parameter"

Jacques Le Roux
Administrator
OK, sorry no only paranoid but moreover impatient
Jacques

Jacques Le Roux wrote:

> Forwarded
>
> Ok, once more I need to put a tiny link to get through, this begins to bother me
>
> Are links in mail forbidden now? Is it me only (paranoia mode ;o)?
>
> Jacques
>
> Jacques Le Roux wrote:
>> James McGill wrote:
>>> On Fri, Jun 4, 2010 at 11:51 AM, Jacques Le Roux <
>>> [hidden email]> wrote:
>>>
>>>> Ha yes, you need to feed facilityId from parm0 in the lookup screen
>>>>
>>>> Something like
>>>> <set field="parameters.facilityId " from-field="parameters.parm0"
>>>> default-value="${parameters.facilityId }"/>
>>>>
>>>> HTH
>>>>
>>>> Jacques
>>>>
>>>>
>>>>
>>> I don't believe the usage of target-parameter is documented anywhere,
>>
>> Wrong, it is into widget-form.xsd for years. I just improved the documentation at
>> http://tinyurl.com/3x8opyr
>>
>>> but there is one example in
>>> applications/marketing/widget/ContactListScreens.xml#LookupPreferredContactMech
>>>
>>> I thought the idea was that you could use target-parameter to inject named
>>> parameter/values into the query.  It turns out
>>> that you have to change the lookup screen to accept "paramN" parameters
>>> explicitly.
>>
>> Yes, I must say I got caught by this one too the 1st time I used it.
>> We are like spoiled child, no not all is magic in OFBiz (some volunteers work underneath ;o)
>>
>> Jacques