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
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?
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
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?
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.
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.
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
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.
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
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?
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..
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..
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
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!
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
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?
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
Yes, it is the post you linked. The CEWP is below the list web part I’m trying to get working.
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?
Hi,
Which code is it you are trying to use?
Alexander
The VerticalScrollingWebPart
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
Hey All,
I am using this script with a calendar view. I get any alert in the script but nothing pops up on the hover. No line, no square, nada. Has anyone had this issue where the script has not worked? What did you do to fix it? Thanks.
Sharonda
Which article is this comment related to?
Alexander
Hi – I get the jquery to run, looks like connections to list are working fine, no errors display. The CEWP is below the list (tried it both ways), confirmed the only field name is plain text (using ‘title’) – results are a blue box and if I roll mouse over I see forward/back controls. No browser errors. List items are eluding me. Have tried a few lists. What have I forgotten? The environment is 2010. Thanks.
Thanks for creating this. I have it working with the new star voting but it’s not keeping count. I tried to give all authenticated user full control and I am a site admin but the count is not being tracked. Not sure what else I should look for? Thanks.
Bring up the developer console (hit F12 > Console) and look for errors.
Also ensure you use the correct parameters in the function call. Post any new questions in the relevant article.
Alexander
Hi,
Thanks for providing this useful information.
I have successfully implemented this however I can see the “Like” and “Count” functions but when I click “Like”, it registers as a count but when I go back to the page, it resets back to 0.
Please could you help me ascertain how to set it so that the count is saved.
Also – the page Hits doesn’t work either. It just says 0.
I am implementing this solution on a “Page” rather than a list.
Regards
Sanjay
Hi,
Hard to tell what could be wrong, but often it is the baseUrl that is wrong. Do you get any errors in the developer console?
Alexander