This topic is locked

Dependent lookup when "master" field value changes in code

2/29/2024 7:05:09 AM
PHPRunner General questions
N
Nikos Tsikas author

Hi all,
as the title says, I have two lookup fields, say STATUS and REASON.
When the user selects a STATUS, the REASON lookup that depends on the STATUS behaves as it should, showning only reasons that are of this STATUS.
However, if I change the STATUS programmatically, using ctrlStatus.setValue('xxx') the REASON lookup behaves as there was no STATUS change and shows nothing (or the reasons of the previous status value). The only way that this works, is if the status is set as lookup with list popup. In this mode only, the REASON lookup shows that actual values of the STATUS set in code. I guess setting the value in code, doesn't trigger the reason lookup values to be updated (AJAX not sent to server maybe?)
So the question is what should i do in code, to force the depended lookup to refresh?
If there is no way to do it, how can i trigger in code the depended lookup list to popup, without the user having to press the "select" link button?

Thank you in advance,
Nikos

Sergey Kornilov admin 2/29/2024

If you use PHPRunner's API like setValue(), the dependent dropdown box will be refreshed. If this is not happening, there might be something else that is getting in the way. Just in case make sure that there are no Javascript errors on that page.

N
Nikos Tsikas author 3/9/2024

This is the code. I do use setValue but it doesn't work :(
(ctrlProblem depends on ctrlCallStatus value)

img alt

var ctrlDialerAgent=Runner.getControl(pageid,'dialerAgent');
var ctrlcallHangup=Runner.getControl(pageid,'callHangup');
var ctrlcallStart=Runner.getControl(pageid,'callStart');
var ctrlTalkTime=Runner.getControl(pageid,'talkTime');
var ctrlCallStatus=Runner.getControl(pageid,'callStatusId');
var ctrlProblem=Runner.getControl(pageid,'problemId');
var ctrlCallClassificationGroupID=Runner.getControl(pageid,'callClassificationGroupID');
var ctrlCallClassificationID=Runner.getControl(pageid,'callClassificationID');
if (ctrlcallHangup.isEmpty()){
alert('Need to hangup first');
return false;
};

if (ctrlProblem.isEmpty()){
alert ('Please select problem kind');

if (ctrlCallClassificationID.getValue()==1002)
ctrlCallStatus.setValue(1154);
}
if (ctrlCallClassificationID.getValue()==1003) {
ctrlCallStatus.setValue(1155);
}
if (ctrlCallClassificationID.getValue()==1004) {
ctrlCallStatus.setValue(1156);
}
if (ctrlCallClassificationID.getValue()==1023) {
ctrlCallStatus.setValue(1187);
};

ctrlProblem.show();
return false;
};
D
DRCR Dev 3/9/2024

We all want to help you, thats what this forum is for, but I have read and re-read your question and I'm overhelmed by the data dump. Lets try this another way:

What is the problem
and
What are you trying to achieve
and
What is not happening (in a few words) to what you expect.