Comments after return in Client Method leads to 'event handler' error

Hi community,

I discovered a strange behavior in Innovator 12. 

Let´s assume we have a regular Form with a button that uses the following onClick event:

alert("This is just a test button event");
return;
// Todo for later: add additional validation

This Method will lead to the following error Message:

'Event handler' failed with the message: ReferenceError: func $ BD472BC271CA48E88DE6CB0C7E3CED75 $ _onclick2 is not defined

I noticed that the Method works fine, as soon as I remove the comment behind the return. Of course in normal code we most of the time do not have any additional comments after the final return.
But when creating new Methods, I often place later used code at the bottom so I can take care for it later.
Comments after the return statement were never any problem in Innovator 11. It took me quite a few days until I finally discovered why certain parts of my new code never worked.
Is there an explanation for this new behavior? Are there any other new design rules to consider when programming in Innovator 12?

Would be happy about any hints to avoid similar effects!
Thanks!
Angela


Parents
  • Hi Chris,

    do you know if this error has already been resolved in some of the latest Innovator versions? I got the same error message when trying to use async functions in a client Method. E.g.:


    async function mytest() {

      var promise = new Promise((resolve, reject) => {
      setTimeout(() => resolve("done!"), 1000)
    });

    var result = await promise;

    alert(result);
    }

    mytest();

    This one will lead to the error message when I run the Method with a Form onClick button event:

    Event handler' failed with the message: "func $ B939B3B5930742458E4CB9100BF6E284 $ _onclick2" is undefined


    But the error only will appear in Internet Explorer 11. Not in Chrome or Firefox. After some reading a figured out async/await is supported for all browsers, expect IE11. But I thought it worked in the past. 
    So I am not sure if this one is related to the browser, or just related to this simple little Innovator glitch.

    I really pray it´s not the browser GrinI wanted to use async/await cause it´s much more simpler to use than chained promises. In my current use case I have so many that it´s hard to keep an overview.

  • Hi Angela,

    Based on the description, this sounds like a browser issue unfortunately. You're probably seeing a similar error message because the async/await keywords are not recognized and thus lead to invalid syntax. I also prefer to use async/await since I think it's easier to understand, and I can confirm that it is possible to use with Innovator in general.

    Chris

Reply Children