Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

typeError xyz is not a function

Avatar

Former Community Member

I have a large set of functions in a scripting object. This has worked fine for some time. However, sometimes, I get the message, "typeError xyz is not a function" when I call the function (which as existed for some time) from a form field. Yet, it will work when I cal it from another form field.

I've run a JavaScript checker on it and there are only a few low-level errors (missing semi-colons) that don't fix the problem. Moving the functions to a new scripting object cures the problem.

Any ideas why this occurs?

2 Replies

Avatar

Level 10

Hi,

it's impossible to say what's going wrong in your form without seeing it.

But, generally even with a "low level" typo a script will possibly fail.

Also, make sure you don't use reserved strings (i.e. x, y, this, name ... ) for your own functions, this can cause very strange behaviors.

Avatar

Former Community Member

Hi, Thanks for the reply and I think you are correct...but can't seem to find it. The object has a lot of script. I have run it through a JavaScript checker and there were only a few minor problems, i.e missing semi-colons, and it didn't fix it. I think I will have to wrap the internals of every single function to find it. I'm puzzled that the same function can be called in several different places and fail in only one.

The script is problematic when pasted into another xdp, which seems to point to something it doesn't like in the script. I've also tried using xfa.resolveNode to reference the scripting object but still no joy. In the meantime, splitting it in two seems to prevent it.