I'm struggling to get the id of a form to be unique based on the page it is used on. The template renders but when the form is submitted I get a fatal error.
The ID needs to be different as the responses need to be saved in separate lists based on the page.
The opening tag to the form looks like:
Note: the error occurs whether or not its running through perch_forms or mbk_forms.
The form renders OK on the page:
However when submitted I get:
Code
- Fatal error: Uncaught Error: Call to a member function label() on null in /path/to-site/perch/addons/apps/perch_forms/runtime.php:27 Stack trace: #0 /path/to-site/perch/core/lib/Perch.class.php(134): perch_forms_form_handler(Object(PerchAPI_SubmittedForm)) #1 /path/to-site/perch/core/inc/forms.php(9): Perch->dispatch_form('tester:perch_fo...', Array, Array) #2 /path/to-site/perch/core/inc/forms.php(23): perch_find_posted_forms() #3 /path/to-site/perch/core/lib/Perch.class.php(235): {closure}(Object(PerchSystemEvent)) #4 /path/to-site/perch/core/runway/start.php(36): Perch->event('page.loaded') #5 /Users/tonyastley/Documents/Websites/SpeechWrite/2021-website/site- in /path/to-site/perch/addons/apps/perch_forms/runtime.php on line 27
Can anyone help or suggest a different method to dynamically separate form responses?