Hi,
I would like to use the Before Edit (BE) event in PHP and understand how it works. It is in the browse and edit form patients section.
My goal is to populate an html field (used like a display field) that supports carriage returns.
I’ve created an HTML object named
Code: Select all
htmlResumePatient
Code: Select all
$pat_id = '#RECORD_ID#';
$sql = "SELECT CONCAT(
p.pat_civilite, ' <b>',
p.pat_prenom, ' ',
p.pat_nom, '</b>, <b>',
TIMESTAMPDIFF(YEAR, p.pat_date_naissance, CURDATE()), ' ans</b>, né ',
p.pat_ald
) AS resume
FROM patients p
WHERE p.pat_id = '$pat_id'";
$res = nuRunQuery($sql);
$row = db_fetch_array($res);
$texte = addslashes($row['resume']);
nuJavaScriptCallback("nuSetValue('htmlResumePatient',`$texte`,'html');");
I also tried the simpler version:
Code: Select all
nuJavaScriptCallback("nuSetValue('htmlResumePatient',`test`,'html');");
Could you confirm whether nuJavaScriptCallback() is actually executed in the Before Edit context? Or am I missing something (maybe just a typo I can’t spot after a long night…)?
Also, more generally:
What kind of code is best suited for the "Before Edit" event?
I’ve noticed that the echo() function often crashes the solution in nuBuilder — as is usually the case when using it.
What are the limitations in terms of updating or displaying content?
Thanks a lot in advance for your help!
Best regards,
Yves