Custom JS work in Google Chrome but not in IE11

Forums Classic DFFS Custom JS work in Google Chrome but not in IE11

Viewing 1 reply thread
  • Author
    Posts
    • #28779
      Steve
      Participant

      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 4 years, 1 month ago by Steve.
      Attachments:
    • #28791
      Alexander Bautz
      Keymaster

      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

      • #28793
        Steve
        Participant

        You’re a magician Alex, thank you, it works perfectly. I hope it will help other people someday.
        Thanks.
        Steo

Viewing 1 reply thread
  • You must be logged in to reply to this topic.