Home › Forums › Classic DFFS › Custom JS work in Google Chrome but not in IE11
- This topic has 2 replies, 2 voices, and was last updated 6 years, 2 months ago by
Steve.
Viewing 1 reply thread
-
AuthorPosts
-
-
February 21, 2020 at 13:03 #28779
Hello,
I have a piece of code:function rozjedTo() { function RemoveAccents(str) { var accents = ('ÀÁÂÃÄÅĄĀāàáâãäåąßÒÓÔÕÕÖØŐòóôőõöøĎďDŽdžÈÉÊËĘĚěèéêëęðÇçČčĆćÐÌÍÎÏĪìíîïīÙÚÛÜŰŮùűúûůüĽĹŁľĺłÑŇŃňñńŔŕŠŚŞšśşŘřŤťŸÝÿýŽŻŹžżźđĢĞģğ'); var accentsOut = ("AAAAAAAAaaaaaaaasOOOOOOOOoooooooDdDZdzEEEEEEeeeeeeeCcCcCcDIIIIIiiiiiUUUUUUuuuuůuLLLlllNNNnnnRrSSSsssRrTtYYyyZZZzzzdGGgg"); str = (str.split('')); var strLen = str.length; var i, x; for (i = 0; i < strLen; i++) { if ((x = accents.indexOf(str[i])) != -1) { str[i] = accentsOut[x]; } } return str.join(''); } let stat = getFieldValue("Stat"); let vysledekStat = stat.toUpperCase(); let trimStat = vysledekStat.trim(); let sapJmeno = getFieldValue("Jmeno"); let sapPrijmeni = getFieldValue("Prijmeni"); let sapUsername = sapPrijmeni.substring(0, 5) + sapJmeno.substring(0, 3); let vysledek = sapUsername.toUpperCase(); let rozdilovka = ("P"+ vysledekStat + "-" + RemoveAccents(vysledek)); setFieldValue("sapUsername",rozdilovka); }It works great in Google Chrome and MS Edge, but not in IE11.
If I open development tools – console in GChrome – it shows no errors.
If I open IE development tools – console – it shows error depicted in the attachment.
The function is linked to a button “onclick” in “tabs” section.
Thank you in advance.
Steo-
This topic was modified 6 years, 2 months ago by
Steve.
Attachments:
-
This topic was modified 6 years, 2 months ago by
-
February 21, 2020 at 19:54 #28791
My guess is that Internet Explorer is running in compatibility mode and does not support let. Change it to var and you should be good to go.
Alexander
-
February 21, 2020 at 20:00 #28793
You’re a magician Alex, thank you, it works perfectly. I hope it will help other people someday.
Thanks.
Steo
-
-
-
AuthorPosts
Viewing 1 reply thread
- You must be logged in to reply to this topic.
