In this case, the error is thrown in the line with the camForm.on event handler. However, despite the error, the form seems to work fine. What is causing the error?
Why is an error thrown?
You set the type of the form to text/javascript. This causes the browser to evaluate the script as soon as it is loaded, outside of the camunda context. Here, camForm is not defined and the script fails. Set it to text/FormScript to avoid that.
Why does it still work?
Because it is labeled as cam-script it is picked up by tasklist and executed in the Camunda context. Here, camForm is defined.
To sum it up: your script is executed twice, but the first execution fails
Hi! You’re right, I changed the script type to text/form-script and the error disappeared. Originally, it was this way, but I changed it to text/javascript so the Eclipse IDE could highlight the code as Javascript instead of displaying it as standard text.