Hey guys,
I managed to come up with a solution that may not be the most "elegant". I did based on a function that exists on CI forms. There is a specific function to update the manufacturer when the CI model changes. The functions are in the forms "nr_inv_tab.htmpl" and "nr_ops.js".
It went something like this:
In this first part of the code I declare the ID of the field "orig_user_admin_org" that is in the form "detail_cr" and I look for the attributes of that one through a URL and it returns as callback the name of the location of my "orig_user_admin_org".
var zcurrCustID = "";
function zorgChanged(form_name, base_name, lname, fname, mname, cntID, caller_type) {
var IDorg = document.main_form.elements["SET.orig_user_admin_org"].value;
var zFID = document.forms["main_form"].elements["FID"].value;
var zSID = document.forms["main_form"].elements["SID"].value;
var zorgID = document.main_form.elements["SET.orig_user_admin_org"].value;
if (zcurrCustID == zorgID)
return zcurrCustID = IDorg;
var url;
if (ahdframe.currentAction == 0)
{
set_action_in_progress(ACTN_AUTOFILL);
}
url = cfgCgi + "?SID=" + zSID + "+FID=" + zFID +
"+OP=SEARCH+FACTORY=org" +
"+KEEP.domset_name=RLIST_STATIC" +
"+QBE.EQ.id=" + escape(zorgID) +
"+KEEP.backfill_attr=location.name" +
"+HTMPL=javascript:parent.ahdframe.z_name_Location_Callback";
display_new_page(url, ahdframeset.workframe);
if (ahdframe.currentAction == 0)
{
set_action_in_progress(ACTN_AUTOFILL);
}
}
In the previous function it calls the next function that will define where I will insert my CALLBACK and call again the URL to have as CALLBACK the ID of the "location". I did this to be able to preview the "KEY.zlocation" and the "SET.zlocation".
function z_name_Location_Callback(persid, value, rel_attr_val) {
set_action_in_progress(0);
var e = document.main_form.elements["KEY.zlocation"];
e.value = value;
var zFID = document.forms["main_form"].elements["FID"].value;
var zSID = document.forms["main_form"].elements["SID"].value;
var url;
if (ahdframe.currentAction == 0)
{
set_action_in_progress(ACTN_AUTOFILL);
}
url = cfgCgi + "?SID=" + zSID + "+FID=" + zFID +
"+OP=SEARCH+FACTORY=org" +
"+KEEP.domset_name=RLIST_STATIC" +
"+QBE.EQ.id=" + escape(rel_attr_val) +
"+KEEP.backfill_attr=location" +
"+HTMPL=javascript:parent.ahdframe.z_id_Location_Callback";
display_new_page(url, ahdframeset.workframe);
if (ahdframe.currentAction == 0)
{
set_action_in_progress(ACTN_AUTOFILL);
}
}
Here I conclude by inserting the CALLBACK of the last return in "SET.zlocation"
function z_id_Location_Callback(persid, value, rel_attr_val) {
set_action_in_progress(0);
var e = document.main_form.elements["SET.zlocation"];
e.value = value;
}
I realized that using this function it is not possible to return several information with a single "query" being necessary to chain several functions and in each of them to bring different information.