Javascript errors in function zip()

  • Profile Image
    Asked on September 07, 2015 at 07:31 AM

    I'm editing a form's source in Visual Studio and finding flags on the line that renders the zipcode of a standard Mailing Address widget.

    <td width="50%" function zip(){var iterator=Prototype.K,args =$A(arguments);if(Object.isFunction(args.last())) iterator=args.pop();var collections=[this].concat(args).map($A);return,index){return iterator(collections.pluck(index));});}>                            

    Basically VS is complaining of invalid tokens and non-quoted attribute names.

    I'm having a rough time with various javascripts and earlier versions of Internet Explorer and am perhaps hypersensitive to non-standard syntax. What exactly is the Zip function intended to do and is there specific reasons for using syntax that is raising flags for IE's syntax parser?

  • Profile Image
    Answered on September 07, 2015 at 10:57 AM


    I'm not quite sure if this is related to the form's code itself or because of the outdated IE browser.

    IE is quite known for rendering incorrectly some codes, have you tried emulating the form using a much more updated IE browser?

    If you are loading other JS librariers like jQuery, on the same page where the source code is, then there's a possibility that there's a code conflict happening. If that's the case, you can try using $.noConflict to fix this.

    Apologies if my knowledge with that part of the function is quite limited, but it looks like it what it does is it automatically checks the zip code then adding a marker on the map when the form is submitted. There's a map that can be displayed in the submissions page when the address field is correctly filled out, but I am not quite sure of this as there are still a lot of codes that are being loaded from our end, even if you used the source code.

    I hope that helps.

  • Profile Image
    Answered on September 07, 2015 at 12:33 PM

    I think my title might be slightly misleading. I'm not getting Javascript errors in the rendered page itself. I've designed the form in the JotForm portal and then embedded it to a page on my site and am tweaking the source code itself (not just a link). Hence I'm exposing that code to Visual Studio's js parser. And that's where the syntax errors are being reported -- by VS, not by a browser.

    Because I can't realistically test against early version of IE I'm concerned by these hightlighted. If we code verify that the Zip() function serves to place the pin i'd happily remove the line completely. (which i suppose is a valid troubleshooting method either way).


  • Profile Image
    Answered on September 07, 2015 at 01:00 PM

    Apologies for the confusion. Yes, I believe I understand the setup, you are using the form's full source and tweaking it on your own web page, but you are creating or opening it on a Visual Studio.

    If the web page where the source code is embedded has other JS libraries on it, that may be one thing causing a conflict. But based from what you have mentioned, it seems like the error or warning shows immediately?

    Perhaps a screenshot would help for us to easily visualize the problem? I'm not that familiar with using Visual Studio so my answer might be inadequate. However, I have that program to test it out in my end. This is how it looks like:

    It seems to show a validation error but not a critical one. Possibly related on the template used? I'm guessing the web pages created on VS are in format or something similar to that?

    You could try removing it and testing the form to see if it greatly affects the data.