When the field is set to use Modal Dialog in the Preview Extension or in Master/Detail, the server throws an error. However, when I disable the modal dialog, everything works correctly. Below is the server-side code in the Row_Selected event:
public function rowSelected(&$rs)
{
if (CurrentPageID() == 'edit' && !IsAdmin()) {
$protocollo = intval($rs["id_rapporto"]);
$id_azione_corrente = intval($rs["id_azione"]);
$sql = "SELECT id_azione FROM rapporti_azione WHERE id_rapporto = " . intval($protocollo) . " ORDER BY id_azione DESC LIMIT 1";
$value = ExecuteRow($sql);
var_dump($value["id_azione"]);
var_dump($protocollo);
if ($value && $value["id_azione"] > $id_azione_corrente) {
$this->setFailureMessage('You cannot modify this record.');
$this->terminate('rapportilist'); // Redirect to the list page
}
}
}
Observations:
In Preview Page Edit, when the modal dialog is enabled, the server-side script fails and does not process correctly.
In Master/Detail, the same behavior is observed when using the modal dialog.
If I disable the modal dialog, the code works as expected in both cases.
Questions:
Is this a known issue with modal dialogs in PHPMaker for Preview or Master/Detail pages?
How can I ensure the modal dialog works correctly without causing server-side issues in these scenarios?
Environment:
PHPMaker Version: 2024
Thank you for your assistance.
error: Uncaught Error: Syntax error, unrecognized expression: string(24) “Ultimo ID Azione: 199996”
string(23) “Protocollo Corrente: 13”