Javascript syntax error in Traditional Web
Application Type
Traditional Web

Hi,

I'm trying to copy a JavaScript function from reactive to  traditional web, but I keep getting a syntax error. Can you please help me resolve this? Here is the properly working function for reactive, 

document.querySelectorAll("[data-rownumber='"+$parameters.RowNumber+"']")[0].click();

and attached is the syntax error from traditional web (I think it has to do with the quotation marks). Thank you


Screen Shot 2022-06-03 at 2.15.11 PM.png

Solution

Hi Fadi,

The RunJavaScript function you're trying to call receives a Text as input. To make it work you need to encapsulate your javascript between double quotes like this:

"document.querySelectorAll(""[data-rownumber='""+$parameters.RowNumber+""']"")[0].click();"

Note that to escape the double quotes inside the text you just need to double it as I did in that example.

Hope it helps.

Cheers

Solution

Something like this? RunJavaScript doesn't receive parameters as you do on reactive as far as I know.

Solution

Hi Fadi,

The RunJavaScript function you're trying to call receives a Text as input. To make it work you need to encapsulate your javascript between double quotes like this:

"document.querySelectorAll(""[data-rownumber='""+$parameters.RowNumber+""']"")[0].click();"

Note that to escape the double quotes inside the text you just need to double it as I did in that example.

Hope it helps.

Cheers

Solution

Something like this? RunJavaScript doesn't receive parameters as you do on reactive as far as I know.

What Márcio shared. In my example, I missed the "RowNumber" part.

Thanks Márcio!

I thought about deleting my comment because you already the question and gave the solution first, but was also important to share this "little" detail. :)

Glad that worked for you @Fadi Zananiri :)

Regards,

Márcio

Thank you both, combining them worked!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.