Hi, i’ve a lookup field with Allow sort/search and Text input for search that should fill two custom field in add page (it’s not necessary to save those value in the DB).
Thi is my code:
Api_action
$app->get('/getInfoImpianto/{codice}', function ($request, $response, $args) {
$codiceCommessa = $args["codice"] ?? null;
if ($codice !== null) {
$response = $response->withJson(ExecuteRow("SELECT Agente, ManutContr FROM ViewListImp WHERE Impianto = '" . AdjustSql($codice)."'"));
}
return $response;
});
Now, the SQL is correct and x_codice should be correct (the field name for the lookup is codice so #x_codice should be correct.
I dont get why it’s not working. But looks like $(“#x_codice”).change(function()don’t trigger the function, because in Browser → Console → Network i don’t see any Api call to my function.
Any idea how to solve this? thanks!
Ok, I’ve found a strange behavior. If the add modal dialog is disabled, the script is working. I receive ‘Event change generated’ in my console log and all the data in my ‘Inspect → network’ and the fields are filled.
But when i enable again the modal dialog nothing is working anymore, no more ‘Event change generated’ in my console log and no data in my ‘Inspect → network’.
Each modal dialog should have the id selector. For example, one of the id that used by the generated web application is ew-modal-dialog.You may check from the generated views/layout.php file: