none
SCRIPT1014: Invalid character error RRS feed

  • Question

  • I'm getting the error "SCRIPT1014: Invalid character"from some code that I don't believe I've changed recently. A short snippet is shown below:

       for(var i = 0; i < items.get_count(); i++)
       {
        var item = items.getItemAtIndex(i);    
        diagFldName = "fieldsTitle";
        var title = item.get_fieldValues().Title;
         
        if(myval == title)
        {
         diagFldName = "fieldsFileRef";
         picPath = item.get_fieldValues().FileRef;
         //picPath = prtcl + "//" + host + picPath; 
         picPath = "//" + host + picPath; 
         jq("#slctdMembrHidn").val(picPath).trigger("change");
         filRefFnd = true;
         break;
        }  
       }

    and the exeption that I'm getting seems to be coming from this particular line of code:

    jq("#slctdMembrHidn").val(picPath).trigger("change");

    The actual value in picPath seems to look ok when I hover over it when in debug, and the code does actually execute down to the jquery statement, but I'm not sure why. I'm going to try to figure out what character it doesn't like, by trying to view some of the internal values of the exception.

    Thanks for looking.

    Henry

    Monday, March 27, 2017 9:01 PM

All replies

  • Hi Henry,

    Please hardcode a string value(a valid value) to val() function for another test, like:

    jq("#slctdMembrHidn").val(“//abc/library/pic.png”)

    Best regards,

    Patrick

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, March 29, 2017 3:11 AM
    Moderator
  • Hi Henry,

    Any progress?

    Best regards,

    Patrick


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, March 31, 2017 10:59 AM
    Moderator
  • Patrick, I have simplified and rearranged my code a bit and the problem is no longer occurring. So not sure what was wrong. I will pursue it further if it rears its head again at some point. Thanks. Henry
    Friday, March 31, 2017 1:27 PM
  • Please try to decode pic path using javascript:

    https://www.w3schools.com/jsref/jsref_decodeuricomponent.asp

    var uri = "https://w3schools.com/my test.asp?name=ståle&car=saab";
    var uri_enc = encodeURIComponent(uri);
    var uri_dec = decodeURIComponent(uri_enc);
    var res = uri_enc + "<br>" + uri_dec;


    Thanks, Amit Kumar, LinkedIn Profile ** My Blog

    Friday, April 7, 2017 8:04 AM