Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Client side scripting for web part

  Asked By: Nilay    Date: Jan 24    Category: Sharepoint    Views: 1642

I am writing client side script(javascript) for a web part am
developing. Everything runs fine, if the script is embedded directly in
the web part.
But if the script is not embedded and Linked script file is used, then
it gives an error at runtime saying that it cannot find the object
(function). I did "view source" of my page, and the script for the
function was not included, though link to the script was there.

Has anyone encountered this problem before?



5 Answers Found

Answer #1    Answered By: Sheena Ray     Answered On: Jan 24

Where did you store the Javascript file? Try storing
the Javascript file  in the Layouts folder.

You can try creating a folder on the same level as
images and try storing the Javascript file out there.
I have done it in the past and I think thats where I
had stored the file.

If that doesn't work let me know and I will check into

Answer #2    Answered By: Jaime Weaver     Answered On: Jan 24

I stored the file  in _wpsources folder as directed in the Msdn help. This is
the page  I referred

It finds the proper path and is successful in registering the script, but does
not find  the function. When I do view  souce on the portal page where the web
part is deployed, I can see the path registered but the script  is not included.

I gives me error  of "Cannot find the object" at the statement where I call the

Do I have to place it in Layout folder?
Please let me know how you had done it.

Answer #3    Answered By: Anibal Baird     Answered On: Jan 24

It can happen only if it doesn't find  the file. I have used  the script  file,
it works fine.

Answer #4    Answered By: Karla Morrison     Answered On: Jan 24

Correct, it does not find  the file. But am unable to figure out why? I have all
the permissions I need on the folder. The ID under which the process is running
has all the rights on the _wpsources.
The path for the .js file  gets registered in the portal page  Html, but when I
call the function, it gives me error  of "Object needed not found". I followed
the process given in Msdn help.
Please let me know how you used  the file.

Answer #5    Answered By: Patricia Richardson     Answered On: Jan 24

Try keeping .js file  in the same folder where your site is created.

Didn't find what you were looking for? Find more on Client side scripting for web part Or get search suggestion and latest updates.