Clarification Needed on report.php Requirements for Custom Forms in OpenEMR version7.0.3

Situation
I’ve developed a custom form (nieuw_consult) in OpenEMR that saves data correctly and appears in the UI as expected. However, the form summary view fails with the following recurring error:

pgsql

CopyEdit

OpenEMR\COMMON\Forms\FormReportRenderer->renderReport() form is missing report function {"formdir":"nieuw_consult","formId":"X"}

Even though the report() function is defined in report.php, and return true; is placed at the end of the file (outside any function), the system does not recognize it. I have confirmed there is no HTML or output outside the report() function. Permissions are set correctly (644, owned by www-data), and the form is enabled and registered.

The issue persists even after clearing browser cache and reloading OpenEMR. I’m wondering if this may be due to internal caching, missing re-registration, or another requirement not documented in the form development guide.

Could the team clarify:

  • Are there hidden requirements for OpenEMR to recognize report() in custom forms?
  • Does a modified report.php require manual re-registration of the form?
  • Are there logs or diagnostics specific to FormReportRenderer that I can check?

OpenEMR Version
I’m using OpenEMR version: 7.0.2-dev (latest master as of May 2025)

Browser
I’m using: Google Chrome Version 124.0.6367.61 (Official Build) (64-bit)

Operating System
I’m using: Ubuntu 22.04 LTS (Running locally on Apache with PHP 8.1)

Search
Yes, I searched the forum and GitHub issues for similar cases. I found references to report() but no clear solution to this exact issue.

Logs
Yes, I checked the logs. Here’s the relevant error:

css

CopyEdit

[2025-05-05T19:29:09.147064+00:00] OpenEMR.ERROR: OpenEMR\Common\Forms\FormReportRenderer->renderReport() form is missing report function {"formdir":"nieuw_consult","formId":"30"}

Let me know if there’s any additional diagnostic I should enable or if you need my full report.php for context. I’d appreciate any guidance or clarification.

Best regards,
Henry Wielzen
Urology Resident

hi henry, first of all welcome to the openemr community.

i’m happy to look at this if you could share all the files for your form (so i can try to reproduce the error), including report.php. I’m also running on ubuntu. I’m also using the dev releases and notice that the latest one that I have is 7.0.4-dev

I have time tomorrow - i’m in london uk, so nearly the end of today for me right now…

Hi Ruth

Thank you again for the warm welcome to the OpenEMR community and for your willingness to help.

I’ve made some solid progress regarding the report issue, but there is a new issue i cant seem to fix

The original issue I reported , where OpenEMR couldn’t find the report() function in report.php for my custom form eden_funcles — is now resolved. It turned out the issue was due to how the function was defined and structured. I’ve now implemented the report() function correctly, following the structure used in OpenEMR’s native forms. The summary report displays as expected and no longer triggers the error.

New Problem: Edit Mode Still Not Functioning

After fixing the report view, I moved on to enabling edit functionality. I’ve added logic to view.php to detect when mode=edit is present in the URL and to include new.php so that the form can load in editable mode. Similarly, I updated new.php to detect when an id is passed and to pre-fill the fields from the database. It also dynamically selects between save.php and update.php depending on whether the form is being created or edited.

The form works well when accessed directly via a URL like:

However, when I try to use the Edit button from within the OpenEMR encounter interface, it still shows the read-only summary view, not the editable form.

At this point, it seems that something in the internal logic or context from OpenEMR (perhaps missing formname, encounter, or ACL-related parameters) is preventing the switch to edit mode, even though the direct URL works. I’ve tried to replicate the structure of OpenEMR’s built-in forms as closely as possible but must be missing something subtle.

If you’ve seen this behavior before, or have any suggestions on how to troubleshoot further, I’d really appreciate your input.

Best regards,
Henry Wielzen
Urology Resident

here i provide the code and correction i am on openemr 7.0.3
form.php (2.0 KB)
new.php (4.5 KB)
report.php (1.3 KB)
update.php (911 Bytes)
view.php (1.2 KB)
info.txt (93 Bytes)
save.php (1.6 KB)
table.sql (580 Bytes)

hi henry - thanks for the files. i’ve not seen this before elsewhere but i have managed to reproduce the problem using your form on my system - so hopefully i’ll be able to see what the problem is…

hi @Henry_Wielzen ,

i’ve been looking at your code.
I think you may not have sent me the latest version of your view.php as i can’t see it including new.php, which, as you say, it needs to do in order to present the editable version of the form, including the ‘save’ button. And in fact when i click ‘edit’ it only displays the form, without the editing function.

btw i wrote the GAD-7 form, and is now part of the openemr distribution. You should be able to see it on your own system, or else it’s on the demo at demo.openemr.io - from the encounter you’ll find it in the ‘clinical’ drop down menu. It’s not done in a very elegent way - i.e. view.php is simply a rehash of new.php rather than include/call it!!

does this help?

Dear Ruth
Yes this truly helped me. i have adapted and compared your form and clinic notes form and come up with a working solution for now, must still evaluate and refactor a bit but here i present a screenshot with the end result and here is the code i am using. Mind you that i am a Urology residents from Suriname with little to no experience in coding, but dedicating 5 hours a day to learn and adapt and has become a hobby now. Thanks since your reply y adapted and got it functioning
info.txt (31 Bytes)
new.php (10.4 KB)
README.md (2.9 KB)
report.php (2.7 KB)
sidebar_dual.php (6.8 KB)
table.sql (729 Bytes)
view.php (4.9 KB)
voorgeschiedenis_modal.php (10.4 KB)

2 Likes

that’s brilliant, well done! - i’m impressed with your new skills in coding! and i’m very happy to have helped.