This topic is locked

Field event not working

4/14/2023 1:28:46 PM
PHPRunner General questions
Travnicanin author

Hi guys.
I cannot get result from query and input it in another field. There are so few examples on the net regarding this..
Client before:
params["value"] = this.getValue();
$myquery = "select Code from Measures where Code='".$params["value"]."'";
$rs2 = DB::Query($myquery);
$result["meas"] = implode($data2);
Client after:
var ctrlMeas = Runner.getControl(pageid, 'measID');
This doesn't work. If I change "ctrlMeas.setValue($result["meas"]);" into "ctrlMeas.setValue('10']);" = it is inputing 10 into measID control.
What am I doing wrong?

wedi 4/14/2023

I'm not sure and maybe I don't understand your query.
You select "Code" from a table with Code=xxx !?
Is it possible that you want to select a different column (for example "meas") from Measures where Code=.... ?
In that case I would use:
result["meas"] = $data2["meas"];

fhumanes 4/15/2023

It seems that you are encoding a custom button, with its 3 states. I think that is not the soluion you need.
The error is in this line:
"params["value"] = this.getValue();"
The reference to "this", in this context is wrong.
This example that I reference is not exactly what you need, but it is the architecture of the solution.