In most cases where users have trouble getting my solutions to work, the problem is the script references. I will give a few examples here on how to troubleshoot these cases.
To copy the script from sourcecode provided in the article, hover over the script and click “view source”. Highlight, copy and paste in notepad. Save with the correct file extension like this:
- Select “Save as” from the file menu and be sure to use the “.js” extention in the file name. Below the file name, you find a drop down where you can set the file type.
- Select “All files”. If you don not do this the file will be saved as “fielname.js.txt”.
To check that the scripts are referred correctly, insert an alert in the CEWP like this:
<script type="text/javascript" src="/test/English/Javascript/jquery-1.3.2.min.js"></script> <script type="text/javascript"> // Check that jQuery is loaded: alert(typeof($)); // Check that a specific function is loaded: alert(typeof(InsertTheFunctionNameHere)); </script>
Both these alerts should give a dialog box with the text “function”. If you get “undefined”, the script reference are wrong.
Another thing:
In most cases the CEWP must be placed below the list for or list view for the code to work.
Regards
Alexander
August 9, 2010 at 2:59 pm |
Greetings,
I am having some trouble getting the character count working on my site. I have tried the ‘checking script’ above and i get the following returned
“Function”
then
“undefined”
I am 100% pointing to the correct script location, is there anything else I could check?
August 9, 2010 at 8:01 pm
Hi,
Is this a customized form?
If so, check this post: How to use these scripts in a customized form
If not, double check the FieldInternalName and that the CEWP is placed below the form.
Alexander
August 10, 2010 at 2:56 am |
Hi Alex,
I was using a customised form but have now reverted to using the default form since I was having trouble. I have inserted the copied code into the CEWP ‘above’ the form. Also I have changed every reference to FieldInternalName to my actual field internal name.
Is this correct?
August 10, 2010 at 4:49 am |
Hi alex, I finally got it to work by moving it to the bottom and correcting my syntax so that I only changed the ‘Mymultiline’ to be my actual InternalFieldName, thanks again.
August 10, 2010 at 11:08 pm |
I am having problems getting my count to work. It doesn’t work as I am typing in the description field. As I’m typing a description, the count remains at 100. Only when I click OK and go back into the form, then it shows me how many remaining characters.
August 11, 2010 at 8:11 am
Hi,
The solution you are referring to is designed for plain text fields only. From your description, i believe you are using it with a rich text field.
Is this the case?
Alexander
August 11, 2010 at 11:15 pm |
Thanks! That solution worked great for me! I just changed my field to plain text. One other little thing, when I’m in edit mode, for some reason I’m getting the “Version:Published Status:Published and visible to all users” with Page, workflow and a Tools tab at the top of the window. Do you know why this may be happening? If I remove the Content webpart, it doesn’t show up.
August 11, 2010 at 11:24 pm
Hi,
I’m not quite sure what you mean, please send me a screenshot and i will look at it. You find my email here
Alexander
September 2, 2010 at 7:21 am |
I have carefully followed the instructions for the new code (ChartUsingGoogleVisualizationAPI_v2.0.js) and I loaded the troubleshooting script you listed. I get “function” followed by “undefined.” Other than setting the link to the user profile and url, am I missing something I should be doing in the CEWP?
October 14, 2010 at 1:40 pm |
Hi,
My code in CEWP goes like this..
alert(typeof($));
My js files are in the correct folder.. Why doesn’t my alert show at all? and when should I expect it to show – the moment I apply the changes or when I close exit mode and reopen the EditForm page?
I have tried placing the CEWP both at the top and below the editForm Page, get no response anywhere..
October 14, 2010 at 1:49 pm |
Hi,
My code in CEWP goes like this..
//
//
//
//
//alert(typeof($));
//
My js files are in the correct folder.. Why doesn’t my alert show at all? and when should I expect it to show – the moment I apply the changes or when I close exit mode and reopen the EditForm page?
I have tried placing the CEWP both at the top and below the editForm Page, get no response anywhere..
October 15, 2010 at 9:44 pm
Hi,
If the
does not give anything i would think you had some sort of syntax error in the script.
Even if the jQuery library wasn’t loaded the alert should give you “undefined”.
Alexander
January 14, 2011 at 9:00 pm |
My count is showing as -1 hits, -1 I Likes. I created the Hit Counter list at the root of my site collection. I am wondering if the Hit Counter list needs to be added for each subsite? Or do I need to change a reference in the .js file. Please help, Thanks!
January 16, 2011 at 7:49 pm
Hi,
The solution is supposed to find a list in the same site. You could fix this by adding a new parameter to the object in the function “spjs_addItem”. The parameter should be named listBaseUrl and the value should be the base url (site root) of the list. You must add this to both the call to “spjs_addItem” and the function itself.
Alexander
August 30, 2011 at 5:40 pm |
Morning Alexander,
Thanks for this solution, I have it running on one of my views and it works wonderful. When I tried to replicate it to another view it’s not working at all. I ran your “alert” script and it shows undefined.
As far as I can tell I’ve done exactly the same thing on both views, one works the other not so much. Anything I could be missing?
September 4, 2011 at 11:06 am
Hi,
Is it this post?
If so, i would guess the CEWP is placed above the list view webpart in the view not working?
Alexander
September 6, 2011 at 10:10 pm |
Yes, it is the post you linked. The CEWP is below the list web part I’m trying to get working.
December 18, 2011 at 4:23 pm |
I’m trying to add this code to my SharePoint On-Line site and I keep getting a GUID error for the list, view and base url…but I followed the instructions. Thoughts on what I’m doing wrong?
December 30, 2011 at 10:25 am
Hi,
Which code is it you are trying to use?
Alexander
December 30, 2011 at 2:20 pm
The VerticalScrollingWebPart
December 31, 2011 at 10:06 am
Hi,
Ensure the base url is correct. Go to the list (AllItems.aspx) – right click and view the source of the page. Search for “L_Menu_BaseURL” – this is the base url.
Alexander
January 26, 2012 at 4:51 pm |
[...] Troubleshooting: How to troubleshoot when the scripts does not work [...]