Fix undefined variable - use \ not \
BUGFIX: Uncaught SyntaxError expected expression, got ')' PROBLEM: JavaScript syntax error on page load caused by undefined PHP variable ROOT CAUSE: Controller passes 'complaint_rows' to view but JavaScript code tried to use \ (camelCase). PHP is case-sensitive, so: - Controller: 'complaint_rows' => \ - View variable name: \ (snake_case) - Used in view: \ (wrong!) When \ was undefined, the !empty() check failed and PHP tried to iterate over undefined variable, generating malformed JavaScript that caused syntax errors. SOLUTION: Changed \ to \ in foreach loop Now the existing complaints will load correctly from database into the selectedDischargeComplaints JavaScript array.
This commit is contained in:
parent
dde54ab80b
commit
f6749d2664
|
|
@ -1668,9 +1668,9 @@ $allergyStatusNoKnown = in_array($allergyStatusNormalized, ['no known drug aller
|
|||
|
||||
function initDischargeComplaintsTable() {
|
||||
// Load existing complaints from PHP (if any)
|
||||
<?php if (!empty($complaintRows)): ?>
|
||||
<?php if (!empty($complaint_rows)): ?>
|
||||
selectedDischargeComplaints = [
|
||||
<?php foreach ($complaintRows as $row): ?>
|
||||
<?php foreach ($complaint_rows as $row): ?>
|
||||
{
|
||||
id: <?= (int) ($row['id'] ?? 0) ?>,
|
||||
term: <?= json_encode((string) ($row['comp_report'] ?? '')) ?>,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user