Uncaught SyntaxError: missing ) after argument list (at userCodeAppPanel

553 views
Skip to first unread message

David Aguiar Aquino Paiva

unread,
May 16, 2022, 4:09:07 PM5/16/22
to Google Apps Script Community
I am spending all day on this issue, tried to search everywhere but as you can see I am stuck with the sanitization debug issue, so I will try to explain what I am doing and what exactly triggers this issue.

Put it simples, I am creating a series of inputs based on the values of a spreadsheet. To be more exact I am creating a schedule function to a lobby app, this function is supposed to have a list of all workers with two time inputs, in a away the lobby worker can fill the time each worker enter and leaves the building.

Thus, I decided to dynamically create a form.

https://pastebin.com/GBLkv3NP

Above I have the .gs code that work on this.

As you can see on this line below:

    agendaColaboradores.append('<input class="elementoFormularioMovCob" type="time" id="movCobHoraEntradaES' + colaboradorTrim + '" name="movCobHoraEntrada' + colaboradorTrim + '"' + 'onchange="teste()"' + '>\r');

It's results on this HTML element, one input for each worker:

<input class="elementoFormularioMovCob" type="time" id="movCobHoraEntradaESWorkerName" name="movCobHoraEntradaWorkerName" onchange="teste()">

And it's seems that have nothing wrong there

The teste JS function it's a really simple function that I use for debugging

 function teste() {

    debugger;

    alert("ha");

  }

(The debugger are not really helping, but I let it there)

But when i change the input value, nothing happens and instead I receive this line on chrome dev console:

Uncaught SyntaxError: missing ) after argument list (at userCodeAppPanel

It's triggers each time I change the input value, which means it's being triggered by onchange().

It's not an error on my .js files since other event triggers like onclick() are working as they should and not triggering said line.

Clark Lind

unread,
May 17, 2022, 9:02:55 AM5/17/22
to Google Apps Script Community
Delete or comment out debugger in the teste() function. It is just sitting there not associated with anything and is probably causing problems. 

If that doesn't help, 
Maybe try using the newer syntax with backticks " ` " and ${variable insertion} . This way, you can also check for any errors easier using multiple lines:
    agendaColaboradores.append(`<input class="elementoFormularioMovCob"
                                                             type="time" 
                                                             id="movCobHoraEntradaES${colaboradorTrim}" 
                                                             name="movCobHoraEntrada${colaboradorTrim}" 
                                                             onchange="teste()">
                                                             \r`);
Message has been deleted

David Aguiar Aquino Paiva

unread,
May 18, 2022, 9:58:17 AM5/18/22
to Google Apps Script Community
So, i needed to rewrite but somehow the issue was gone.
The ${var} it's not working on apps script

Clark Lind

unread,
May 19, 2022, 8:00:08 AM5/19/22
to Google Apps Script Community
Ensure you have the Chrome V8 engine selected in your project to be able to use the newer javascript syntax (under Project Settings:

V8.jpg

Reply all
Reply to author
Forward
0 new messages