Post requests and questions in this post, but be patient awaiting reply or solution examples. This is a “one man blog” and i have limited time to answer questions. There will be less activity during the summer months, but i will keep posting new solutions, only on a slightly smaller scale.
I’m open to requests!
I get many ideas on things to write about from my readers, feel free to make requests on things you would like to learn more about.
I will, from the best of my knowledge (and time), answer your questions.
Post requests as comments to this post.
Use the rating on the request to vote them up, thus “forcing” me to answer them…
The comments are split into pages with 25 top level comments per page, and the last page displayed by default. Use the links at the bottom of the page to read older comments.
First and foremost thanks for everything you have posted!
As you know on all list views and document views, the view selector is on the right hand side of the menu bar. This can make it quite cumbersome for users looking at lists with many columns to change the view. A better option would be for the view selector to be on the left hand side and right hand side of the menu bar. I know I can move the view selector via SPD but would rather use a JavaScript options if one was available. Would this be something you would be interested in creating?
Thanks
tecrms
Hi tecrms,
Thank you for a very clever question! It’s often harder to think out the question than to actually solve the issue.
You find the solution here:
Move view selector to the left
Regards
Alexander
Hi Alexander:
Your work may be fun for you but it’s a gift for us. Thank you!
A small item: I need to hide the “Check Names” and the “Browse” icons on a NewForm or EditForm “People-Picker”.
Thanks-
Charlie Epes
Hi Charlie,
This one is small enough to post directly here. The FieldInternalName of the field to hide these elements on is “Responsible”:
Alexander
Thank you Alexander:
Hiding the “People Picker” icons worksd perfectly.
Charlie Epes
I have a similar request but only need to hide the “check names” icon. is it possible to split this out using your script?
@Nancy:
replace line 6 with this
$(fields[‘Responsible’]).find(‘.ms-usereditor td a:first’).hide();
[/sourceocde]
didn’t come thru clean, may have been me
Hey Alexander,
I currently have a MS Word based form that contains a 2 column by 10 row table where users provide up to 10 keycodes and their corresponding descriptions. I am hesitant to make 20 sharepoint variables to capture this since it will make a mess of the form – and I don’t need to query or report on these fields. Instead I’m looking for a possible solution for pre-populating a rich text field with a table template including column names. This way when a user creates a new item, they will see the familiar table and simply fill it in as per usual.
Not sure if its possible but you have really amazed me so far so figured I’d ask =)
Many thanks,
Marc
Hi Alexander:
Peter Allen of Bits of SharePoint uses JQuery to give a preview of an item in a calendar. Do you think you could do something similar (or with a pop-up tool) if I hover over a versioned multi-line text field’s “View Entries” link in a List?
http://www.bitsofsharepoint.com/ExamplePoint/Site/Calendar.aspx
Charlie Epes
Hi Charlie,
It was actually Paul Grenier who wrote the article. I had not thought about that solution – it was clever.
I have tested his solution and rewritten it to adapt it to pop-up on mouse-over (floating), and to preview only selected values – like what you request. I will post it during the weekend (if i get the time…).
Alexander
Hi Charlie,
Here is my modified solution:
Preview metadata in list view on mouseover.
Alexander
Marc,
Your request is answered here:
Collect input from custom input fields and store in multiline plain text field
Alexander
is there a way to run an sql query and populate a sharepoint list? I have found myself going around my ass to get to my elbow with this. currently i have a sharepoint list as a linked table. I run a query in access to build another table, then run a macro to delete the SP list, another macro to make table in SP list. There has to be an easier way to pull data from a database and upload to SP.
Hi Larry,
I cannot help you with querying other resources than SharePoint lists. “My” queries uses SharePoint web services for the querying.
Alexander
Thanks for responding. If you come across any resources related to this, please let me know.
I have another request, a dynamic quick launch with cookies. this post came close, but too many issues with the script.
http://blog.thekid.me.uk/archive/2007/12/04/updated-dynamic-left-navigation-width-for-sharepoint.aspx
i liked the functionality, but too buggy
What kind of functionality do you have in mind? Just a widening of the quick launch?
Alexander
What I believe to be a useable functionality would be that is has a way to click (the small space beween QL and Content) and drag to the width of user choice. A double here to close it completely, and a final double click on the left, where it has closed, to open back to the size set by the end user. all this also rememberd by cookies upon return to the site ( the defined width by user).
Hi Alexander:
Is there a way to hover over the Title field (or perhaps the Edit icon) in a default List view and have the EditForm pop-up so that the user can edit right then and there?
Thanks-
Charlie Epes
Hi Charlie,
I think it would be possible, but I’m not sure how elegant it would be, as the page would have to refresh to display the new information.
Look at the preview-solution you requested above over the weekend and see if it can be adapted to fill your need.
Alexander
Hi Charlie,
See if you can adapt this solution to your need – it will require some tweaking though.
Let me know if you need some guidance.
Alexander
There are lots of actions that can be performed by Sharepoint when the conditions of a workflow are met such as sending an email to a user, deleting the item and updating a field of an item. But one thing missing is the ability for the workflow to send the item to a printer automatically. We have a list that we use to enter in sales orders and we would really like sharepoint to send the order to a printer when certain fields equal certain values. Is there a script that can be written to do this?
Hi Matt,
I do not have a solution for responding to a change made by a WF, but if the “final” change is made in EditForm, it’s no problem to open the Print Dialog from there.
Alexander
Thanks Alexander. I’ll try out the first solution and let you know about the 2nd.
Charlie Epes
First off you rock! I have learned a lot by following your blog. The question I have is how could you re size the plain text fields so they don’t go the width of the form?
This is something that plagues me and probably everyone else trying to customize those pesky forms.
Also I am trying to figure how to get the quick launch horizontal instead of on the left of the screen.
Thanks in advance.
Hi Mark,
The width of the text field (both single line and multi line) can be set like this:
Alexander
How can I add this function together with Dynamic Forms, cause I’d inserted in CEWP and on IE8 worked right, but on Google Chrome was not rendered
Answered here: https://spjsblog.com/2013/08/12/dynamic-forms-for-sharepoint-v3/#comment-15483
Alexander
Thanks
Good Day Alexander, thanx for the shout out on the alignment.
I ran into an issue today and I am lost. I am not sure how to handle it. I am building a form using a few of your scripts. It is an internal form for my company. Many people do not have admin access to their machine so I figured they could not turn off JavaScript. Well the project owner has JS disabled and I am not sure yet if they can enable it.
My request: is there a way to display a message on the page that says JavaScript is disable, blah, blah , blah… without using JavaScript? almost like the old noscript tags used in html.
Never mind, I answered it myself. the noscript tags work if you place them in a CEWP.
New request. I ahve noticed at the end of each of your script there is a function “function init_fields()”. if implementation several of your script, can this be added to the page one time, at the end?
I know your busy, so I just remove the beginning and ending part of all codes and placed it one time on thr page. appears to be working, will need more testing
Hi,
Yes, it only needs to be added once. In the top of the script like this:
fields = init_fields();
This makes an object of all fields which can be addresses by it’s FieldInternalName. Containing the “tr-tag” and it’s content for that field.
The function can be added anywhere on the page or in an external file.
Alexander
Thanks Alex I really appreciate all you help.
Hi Alex,
The script for resizing the text fields works perfectly.
I have another request. I am trying to get my form to to display in tabs. The form has 40 fields and it needs to be split between 4 tabs like a wizard. Any help would be greatly appreciated.
Have you looked at this script: Dynamic expand/collapse fields or array of field.
You could expand each section by click on a “Yes/No” field above each section. You would have to modify the script, but the basics are described in the post.
Alexander
As if I dont make enough requests. lol Is there a way to create a view or list that display the sites List and Libraries, with a link back to them, if the permissions are inherited from the parent (this links back to the permissions of that list/library) and the date of last modified?
So 3 columns, List/library Name, permissions inherited Yes/No, and dat Last modified. On a side note is there a way to make this a roll up, having this for each sub site, that roles up to the top level.
Hi,
Sorry, but i have no such solution. It is possible, I’m sure, but i do not – as for now – know how to do it.
You could look at the web services sites.asmx and lists.asmx. The list of lists and document library’s should not be a problem, but the inheritance and lastmod, I’m not sure about.
Alexander
Hi Alexander:
When a user attaches a document to an item in a List, the attachments are stored in a hidden document library with the List Item ID as the Library name. The user cannot get to the library, as one would get to a normal Document Library.
Can you think of a way, from a List, to easily attach documents to a visible Document Library and then create and keep an automatic link to the List Item?
Thanks
Charlie Epes
Hi Alexander:
Is it possbile for you to create some code that would hide some of the toobar menu items such as New, Actions, Settings, Views or any of their sub menu selections based on a created permission level (Site Settings > Permissions > Permission Levels) ?
For instance if I created a new permission level called “Director” which is tagged to a user or group, I would like for them to have tailored menu functions in a list or library based on this new permission level…hope this makes sense
thanks.
Hi,
I have no method for hiding menu items based on permission levels, but hiding by group membership is possible. I have written a short article here: Hide menu items in list view toolbar and views in view selector.
Alexander
Thanks!
Good day Alexander, Todays request, amoung the many others :), is there a way to add a function (either by adding a button or an onchange event) that could clear (reset) a predefined set of fields? Example: I am using you script to dynamically hide/show groups of fields. Say today I have 3 groups I show and populate these fields. If somthing changes ion the project tomorrow and I only have 2 groups now, hiding the fields does not remove the field contents. I would like to add a button near the groups of fields that only removes that group of fields contents and does not touch any other part of the form.
Can this be done?
Hi Larry,
I believe this is answered in your other question
here.
Alexander
Hello Alexander,
Firstly thanks for this terrific materal – you have a great gift for educating.
Keping with the excellent discipline of maintaining a library of scripts in a SP library, is there a way to add an “open with” option to the file context menu so the scripts can also be edited in SP (using for example notepad++). Currently , clicking a .js file will try to execute it.
This has uses elsewhere where the associated application is not on the standard list.
cheers.
Hi,
Interesting idea, I will look into this, but i have no answer right now.
Alexander
Hi again,
I do not think this is feasible because Notepad (and other non-office programs) is not compatible with check in/check out etc. I tried to edit the “OpenControl” for txt-files, but all i got was error messages…
My best answer is to switch to “Explorer view” and do it from there.
Alexander
Hi Alexander:
Is it possible to add a clickable “button” or icon next to a date picker that would insert “Today’s Date” into the field box?
If this can be done on the NewForm and EditForm, that would be great. If this can be done on a DispForm or even in a list, that would be fantastic!
I hope you are well-
Charlie
Hi,
Here’s an example – it could be added some functionality for F=first, L=last. Let me know if that would be interesting.
Update: Code moved here:
Set datefield to first day of month, today’s date or last day of month
I wonder why you Would like to have this in DispForm and a list? – please explain.
Thank you for the mail you sent – I’m glad you enjoy this blog, and that you find the solutions useful. I will try to answer your other questions.
Alexander
Hi:
I tried this on an EditForm and NewForm. I can’t seem to get it to work. It’s in a CEWP below the form and pointed to my JQuery 1.3.2 library. I need guidance.
Thanks-
Charlie
Hi,
My fault – see comment in code above.
Alexander
Hi:
The “date picker clicker” works perfectly! Thank you-
Two things:
1.) I’m not sure what you meant when you wrote:
“…it could be added some functionality for F=first, L=last. Let me know if that would be interesting.”
2.) If it’s possible to have this JQuery work on a DispForm and a List View, the user can click once and be done.
Thanks-
Charlie Epes
One more question:
Can the Date Picker Clicker work on more than one date field?
Charlie
I have trouble understanding how you want to use this functionality in DispForm and a list view. Could you describe what you want to achieve with this? (it is possible, but i do not see the full picture).
Alexander
Hi Alexander:
I told a fellow SharePointer about your talent! Now I’m passing on her request.
“We have a custom list with a lot of fields. I need to divide it into sections and then easily show/hide those sections. I am going to try dividing the form into div tags and then use jQuery to display the sections in either
Tabs or an accordion (I’ll send you the email with the screenshots.)
I’m just curious if, in all your SharePoint travels on the web, have you already seen this done anywhere? I’ve seen it done for a navigation menu but not for sections of an editform.”
Thank you-
Rebecca Waild
You find the solution here.
Alexander
Hi:
Similar to the “Date Picker Clicker”, do you know if I could click a link and the users login name would fill a People Picker (person or group)?… on a newform or editform?
Charlie Epes
Hi,
You find the answer here:
Link to fill user login name in people picker.
Alexander
Hi:
I haave users who are updating several date fields all week long and they are being trained to access the SP LList on the day that the action is completed. By clicking on a date field in a DispForm or better yet, a List view, the mouse-clicks are reduced greatly. In this case, speed is of the essence.
Charlie Epes
I have an upcoming solution for editing directly in a list view. I have to do some more testing and tweaking before it is released, but within the week it should be ready in v1.0.
I have tested it with date columns and single line text for now. I may find a solution for editing more fields. For now it is designed for editing one “TD” at the time.
Alexander
That’s great Alexander! Can’t wait to see it
Charlie
The article answering your request is found here: Edit date, single line text, number or boolean columns directly in list view.
Regards
Alexander
I have a project staffing form with a Skills column that is a multichoice field. I’d like to be able to split the selected values into individual keyword (phrases) so that they can be passed into a hyperlink that creates a search query string, i.e, the selected skills are: project management, estimating, scheduling, and the desired search query should be SearchCenter/Pages/peopleresults.aspx?k=Skills: “project management” Skills “estimating” Skills:”Scheduling”
Hi Dean,
Where would you like this hyperlink to appear? DispForm.aspx or in the list view?
Alexander
Thanks for the great site.
Wondering what the easiest way is on a standard share point form to prompt the user with a confirm alert (Ok, Cancel) to control whether or not the form is submitted?
For example, when the user chooses Ok, they are then prompted to confirm if they are really sure they want to submit the form – if they choose Ok, then the form submits. If they choose cancel then nothing occurs and the user is able to continue editing data on the form (i.e. the form is not submitted)
Thanks
FT
Hi,
Add a CEWP below the list form in NewForm and EditForm. Insert this code:
SharePoint automatically executes any code in this function when pressing “OK”. It must return true for the save item to take place.
Alexander
Thanks Alexander – It worked perfectly!
FT
Hi Alexander:
A user asked me if it’s possible to have a button on a List View that, when clicked, would highlight the entire row. This way, the user would be able to flag items for specific review by another user.
I suppose it would be necessary to have it be a click-on/click-off feature. Possible?
Thanks for all your fine work.
Charlie Epes
Morning Alexander:
I ran into this code which is almost exactly what I was thinking about.
http://sharepointblog.spaces.live.com/blog/cns!74C8FB1191265567!526.entry?sa=917815030
I’m not sure if you started on this or not but this might be a good alternative.
Thanks-
Charlie Epes
Hi,
I thought about this request as an addition to the “EditInListView”, by using a yes/no-column to toggle this highlighting.
The issue with the one you link to is that it lives in the current page only – there is no write back. Therefore you cannot have on guy click on the line to toggle “follow up this item”, and another guy finding the highlighted rows.
It has to be a write back action to manage this.
Alexander
An addition to the EditInListView would be great! My company doesn’t allow webmail access so I can’t even get to the WindowsLive account again. Oh well, I rather go with your solution! I never considered the writeback issue….
Is it possible to broaden the EditInListView to “currency”?
Charlie Epes
Currency should not be a problem, i will update the code and let you know when it’s in place.
Alexander
Hi Alexander:
I was wondering if you had time to ponder the “yes/no-column to toggle this highlighting” that you said could possibly be added to the EditinListView.
Post: https://spjsblog.com/2009/11/05/requests/#comment-680
Thanks-
Charlie Epes
Hi,
Thank you for reminding me of that. Here it is:
Highlight row by value in Yes/No-column
Regards
Alexander
I’ve got a list with columns that indicate individual’s status on certain days of the week. I’ve created views for each day of the week that only show the columns that apply to that weekday. Now I want a webpart that uses javascript to determine the current day of the week, then displays the view for that day.
Almost forgot – thanks bunches! Your tip about how to edit a page that you’d hosed up with a faulty script just rescued my day! 🙂
Hi,
Here is a simple solution that reads the current day and redirects you to a view with that name:
Add it to a CEWP in your view’s.
If you add “?StopRedirect” to your url, you stop the redirect action (to let you edit the script without having to wait for the right day :-))
Regards
Alexander
Hi Alexander:
Thanks for the Tabs solution. I’ll try it this week.
I had another thought/request.
1.) Is it possible to wrap a List View of field headers and the data into two rows?
ListView Example (before):
Col1 Col2 Col3 Col4 Col5 Col6
data1 data2 data3 data4 data5 data6
ListView Example (after):
Col1 Col2 Col3
Col4 Col5 Col6
data1 data2 data3
data4 data5 data6
Thanks-
Charlie Epes
Hi Charlie,
Once again i must ask what you want to use this for… With one heading column, and one data column like you sketch, it will work. But if you add more rows in the form – how will users know which heading is for what field?
Alexander
Hi Alexander:
On several of my lists, I struggle with the width of the page and too many fields. I use some simple javascript to wrap the column headers but I still need to prevent users from having to scroll side to side.
My thought is that like-fields, such as date fields, could be clustered together, either on top of each other, or on a 2nd row.
For example, another .Net application I use (which is similar to yours “today’s date picker clicker”) the stages in a process are stacked in 2 columns. I will send you a screenshot via gmail.
Charlie Epes
Hi Charlie,
Not directly what you asked for, but this might work:
Show current row wrapped in a floating table when hovered.
Alexander
Hi Alexander:
Thanks for this. It’s not what I was thinking about but I’ll take it!
Charlie Epes
I really like your Tabs in SharePoint form you posted. Is there any chance that you might create a tab container that places webparts on the page into it? For maximum user could they be selected by webpart ID and not by the zone. This way more than one tab container could be placed anywhere are the page.
Hi,
Take a look at “Easy Tabs” from Christophe at PathToSharepoint.
No need to invent it again if his solution does what you want…
If this is not what you need, let me know and i will look at it.
Alexander
Christophe’s Easy Tabs is an excellent webpart but it grabs everything within a webpart zone. What would be nice is to allow the selection of which webparts are to be placed in the tabs from the webpart zone. This will give one more ability to have more than one “Eays Tab” type webpart within a webpart zone.
Another method for arranging webparts in tabs in a webpart page is found here.
Alexander
Hi Alexander,
I would like to use your headings solution but in the displayform have one of my other fields display as text after the heading so:
This is a heading – this is a field.
Would this be possible?
Thanks
Andrew
Hi,
I’m not sure what you mean – can you explain a bit further?
Alexander
Hi Alexander,
I mean when the headings appear in the dispform I would like one of the fields to appear alongside it. So a text field is displayed against the heading.
Thanks
Andrew
Hi,
Take a look at this two articles and see if you get some “inspiration”:
Modify formlabel in SharePoint form
Add individual label for each choice in multichoice list
Alexander
Hi Alexander
This is what I am after but I wanted it to be shown against a field used for your headings article but obvisouly this hides the field on the form and just shows what you have in the field for example:
#H#17#880077#Outcome
What I would like is an internal fields contents to be shown after the outcome text before in the DispForm.
Thanks
Andrew
Hi again,
Is what you want just to “fatten” up the existing field label for a singe field?
Alexander
Hi Alexander,
Sorry if I seem to be confusing you. What I have at the moment is a heading created by your headings article which is called ‘OUTCOME’. I then have another field called DESCRIPTION which text is entered in to.
In the Display Form I would like the contents of the DESCRIPTION field to show alongside the OUTCOME heading. For example it would look like the following in the form:
OUTCOME — contents of DESCRIPTION
next field
next field
next field
If you still do not understand then please let me know and I could provide you with screenshots.
Thanks
Andrew
Is this beginning to resemble what you are after?
Before
After
Script
Alexander
Hi Alexander
This is exactly what I am after, I will give it a go and see how I get on.
Many Thanks
Andrew
Hi Alexander,
I would like to ask you for help, regarding setting a people picker field to be read only on EditForm. There are 4-5 people picker fields and i have nicely implemented the script to hide the checkperson and browse buttons, it works great thanks, but now i need to make those fields Read Only and they are filled with values. I have already tried with a script to find elements and hide the people picker field by the title element but it works only for the first people picker field, not for the rest of the form. Any help is welcomed.
Thanks,
Esad
Hi,
I have answered a question like this in another post. See what you get out of it, and ask again if you do not get it right.
Alexander
It does the job, makes the field read only but it also swaps from display name to account name and am running from this issue.
Is there any way to make the people picker field read-only but also to retain the Display Name in that field instead the account name.
Hi,
Which browser do you use? In my setup it does what you want. If you send me the code by e-mail, i can look at it (not the fieldutility.js).
Alexander
Hi Alex, sorry for the late reply, holidays:)
I am using IE7, and i got it fixed somehow 🙂 Thanks a lot Alex, i drink my coffee and check your website almost every day.
I do have another question if it is appropriate to ask in this post, and it is regarding how can i check if attachments are present on NewForm, and if not to push an alert. I know the PreSaveAction function does simular job, but have no idea for attachments.
Thanks again,
Esad
Try this code:
Alexander
Works like a charm. Attachments in sharepoint item are a must have now thanks to you. Dunno why MS doesn’t include it as an option already.
Thanks Alex,
Esad
Hi Alexander,
I am not sure if you have recieved this request before, but it is related to this website, not a javascript request. I was wondering if a “Table of Contents” could be added in addition to the forward/backward choices at the top. Perhaps this already exists somewhere and i missed it. I love this site and look at it often, but i’d love to be able to go directly to an entry.
Thanks for all of your hard work (and generosity in sharing!)
Tasha
Hi,
I agree with you, it would be nice to have a complete TOC of all posts, but I have not found any plugin available in WordPress that provides this.
It would have to be a manual job making this list… I will look into it if i find time.
Regards
Alexander
Hi Alexander I am trying to perform the accordion with the Jquery UI. It works if I do it in a New, Edit, Display form. but when I try to create a single item form in SPD I am having no luck. Any assitance would be greatly appreciated.
Hi,
I answered your question in this post.
Regards
Alexander
Oh yeah by the way I was able to locate a wordpress plugin for TOC.
http://www.evanscode.com/wordpress-table-of-contents-plugin/.
Hi,
Thank you, but this is only for making a TOC in a single post, and not to “index” all posts in a blog.
Regards
Alexander
Hi Alexander,
if you are still looking for a site wide TOC this might help you
http://wordpress.org/extend/plugins/table-of-contents-creator/
regards
Chris
P.S. Still trying to get the “visible to” script to work.
Thank you Chris,
My problem here is that my blog is hosted at wordpress.com, and i cannot upload custom plugins… I might move the blog to my own server later on, and then it can be used.
Regarding the “visible to” – problem, just send me the code to look at, and i will try to help. You find the address in the “About” page.
Alexander
Hi Alexander
Is there a way to hide fields from showing on a form?
Thanks
Andrew
Hi,
I have done a post on Dynamic expand/collapse fields or array of fields.
In this code you will find the essentials for hiding a field or an array of fields.
Ask if it’s hard to “extract” what you need from the code, and i will point it out to you.
Alexander
Hi Alexander
I have used the code but can’t seem to figure out which are the vital bits of code I need as it seems to mess up my dynamic expand fields in my form. If you would point the code out that would be very useful.
Thanks
Andrew
Hi,
In this comment, in the code line 11 you find the line that hides the field.
You have to refer jquery and to include the function init_fields() to use this method.
Alexander
Thanks Alexander I will try and hide my other fields that I require.
Thanks
Andrew
Hi Alexander,
I am trying to put some jQuery script into an EditForm but when I add the CEWP, the page gets locked into ‘edit’ mode. The site in question has Publishing switched on, and I believe this is the problem. Have you come across this issue and, if so, do you know of a workaround?
Many thanks
Stuart
Hi,
Are you sure you haven’t forgot to remove the “toolpaneview=2” from the url?
If not i have not seen it before and have no real solution.
Alexander
Good day Alexander,
I believe I have a simple request. I have found that some of my user have disable scripts in IE. In a CEWP I added noscript tags and in the no script tags I put a message to enable scripts and added css to hide the form. either my css is incorrect or this cannot be done. My request is I need a noscript way to dynamically hide the list form until user enables their script. here is my css. maybe I have id’d the wrong list form webpart.
#MSOZoneCell_WebPartWPQ1 {
display:none;
}
I have tested this several ways, and this works on my machine, but for some reason there are users that when they access the page the scripts dont run but they still see the form. do you know of any reason why this might happen. My script library is local and all users and domains have access.
I think identified the issue but still no luck on fixing it. I found some users are on IE 6. I am not sure how to make the script work for IE 6. Any thoughts?
I have no experience using noscript tags, but is it the script or the css that does not work in IE6?
How does SharePoint act when browsed with scripts disabled? I would guess it did not work as expected?
Alexander
the no script tag allows you to provide text for users that have scipt disabled. When I disable the sciript in my browser it works. These other users have something else. I noticed they are using IE6, and had a different security setting, but I have not been able to identify what the different is because I do not have access to their machine. when i run IE6 it works perfectly, so I know it is not you script or how I implemented it. I also confirmed that their scripting setting were set to enabled which really throws me off. I have no clue what security setting disabled causes this.
Hi Alexander
Is it possible to be able to move the OK and Cancel button to the left hand side in the New, Edit and Display forms?
Thanks
Andrew
Also is it possible to be able to change the background colour of a field to a different colour?
Thanks
Andrew
Hi, This is the answer to the first question.
Add a CEWP below the NewForm, DispForm and EditForm and add this code:
Alexander
And this it the answer to th second question:
Add a CEWP below the NewForm, DispForm and EditForm and add this code:
Alexander
Hi Alexander
They both work great. Thanks for your help it’s very much appreciated.
Regards
Andrew
is there a way to view all whether permissions are inherent or not in a document library. a script that can convert a calculated field to view all at once so dont have to click each individual item
Hi,
I do not think so, as the permissions are checked when interacting with the element. If anyone has some information on this, please share it.
Alexander
Hi Alexander:
This may have covered elsewhere but do you know a way to hide a Total column’s “Sum=” prefix?
Thanks- Charlie Epes
Hi Alexander:
I figured it out using JS:
Charlie
Hi Charlie,
I tried this code in a SP2010 list, but it’s not working. My SP list is on a sitepage with a graph webpart. What can be wrong?
Thanks,
Jimmy
Hi again:
My next question: Do you know a way to capture the Total’s (ms-vb and/ or ms-vb2) and place them into a CEWP to create a simple KPI or data summary grid?
Thanks-
Charlie Epes
I have been unsuccessful trying to auto populate fields. using your script get user information wss, Is there a way to write the returned data to fields in sharepoint, either through a click event or on page load (page load perfered)? I have a survey for managers. I need their subs to submit the survey and then roll up the averages to each manager. I do not want the user to have to click their name and their managers name, it is suppose to be anonymous. I know wss does not have manager names in the user profile, maybe we can do a lookup on an external list. auto populate user name in a people picker field, this field does a lookup to external list and auto populate managers name in a second people picker. can this be done?
Auto popuplate user in people picker field?
auto populate other information for other fields from external list base on previous people picker?
Hi,
I believe this is related to this question.
Read the answers here.
In general, it could be done like this for a Text-field:
Alexander
Finally made it back to this one. Got it working, trying to implement on people picker. input.val not working. Can you provide the text to change on line 5 for setting a people picker val. I know you have the script with the click event. And using that script I could auto populate the field. I was hoping for a single line, set field val like above.
Hi,
Replace line 5 with this:
Alexander
I was so close. there is a small bug. In WSS when the form load, with the new script, the menu (top right) for my settings opens.
do you know what might trigger that.
I will set my bet on that the FieldInternalName is wrong. Check it again.
Alexander
I’m a dumd ass, damn it! cant believe after all this time reading through your posts I missed that again.
Hello Alex,
I’ve been trying to make a report out of a list but with multiple-filter choice fields that a user selects them and pushes it in the URL string. It works good only when you need two values, but if you want to add another value and then select only two out of the three… and i am stuck.
Any ideas how to make the list to be filtered via multiple options buttons.
I like the new post for the workflows, will implement it.
Regs,
Esad
Hi,
Is it a string like this you are building:
If so, you have to make a function to build the string so that you do not get “holes in the numbering sequence”.
If the user only selects the filter for “Model” and for “Color” the FilterField3 and FilterValue3 must shift to FilterField2 and FilterValue2.
Alexander
Yes alex you are right, working on to make it happen.
Regs,
Esad
[16.01.2010: Edited by Alexander to fix the codeview]
Maybe this time I can post something we can get to work. I have been trying to peice together several scripts, including yours to make the multiple line text fields expandable. I found a workiong script but it only worked on plain text. I am trying to modify it to work on rich text. When i add your script for fieldinternalname I can at least see the image under the rich text box, but it does not work. using the new script I can not get the plain text to work. this is the link to the jquery plugin for textarea resizer
http://plugins.jquery.com/project/TextAreaResizer
here is the script I am trying to modify
the image is just a bar at the bottom of the field.
Can we get this to work with internal name?
can we get this to work on rich text field?
sorry bout the code. I swear I placed the code blocks in.
Hi Larry,
There is no problem making the “Multiple lines of text – Plain text” expandable, but making the Rich text ones expandable proved to be more challenging…
It took me some time to figure it out because the Rich text multi lines are made up of iframe’s and does not like being messed with.
I have the solution mostly finished, but i will test it a bit more to eliminate a few possible bugs before posting it.
It will be ready during the next week.
Regards
Alexander
If anyone could do this, I know it would be you.
Here it is:
Add resize handle to multiline text field (plain text, rich text and enhanced rich text)
Alexander
Hi Alexander
Is it possible to hide the Attachments on the DispForm based on Group Membership?
Thanks
Andrew
Hi,
Yes it is quite simple.
Use the setup found here:
Showing or hiding list fields based on membership in a SharePoint group
But edit the CEWP code like this:
Alexander
Thanks Alexander, that works great.
Andrew
In addition to my previous request. I need to convert my view from horizontal to vertical. I think this should be easy enough. In my view I want to do an average. 12 questions with numeric responses. how can i get the averages vertical also.
currently we have by default
q1 q2 q3
score score score
What I need to do
q1 – score
q2 – score
q3 – score
…
is this possible?
Hi,
I had a similar request here, it is not actually what you ask for, but take a look.
Another approach could be the view style “Preview pane”.
Alexander
Almost, so close. All I really need are totals. I dont need individual row items. In fact I want to hide all row items and average my grouped scores. Can that be done in that preview pane, pull in multi rows and return a total or average?
Hi Alexander:
Do you know of a way to change the “tilt” of a field or column header in a List to verticval or diagonal?
T
h
a
n
k
s
Charlie Epes
Buffalo, NY
css is the easiest way
[sourcecode language="language="javascript"]
.ms-viewheadertr td, .ms-viewheadertr a {
writing-mode: tb-rl;
filter:fliph flipv ;
vertical-align:center;
/*text-align:center;
text-wrap:normal;
LAYOUT-FLOW: vertical-ideographic;
word-wrap:normal;
text-align:center;
writing-mode: tb-rl;
direction: ltr;
filter:flipv fliph;
white-space:normal;
white-space-collapse:collapse;
width:55px;*/
white-space:normal;
white-space-collapse:collapse;
/*color: black !important;*/
}
.ms-menuimagecell, #imnhdr0 {
display:none;
}
[/sourcecode[
the css is mostly for columns in list views, you just need to identify the style or IDs to apply the classes.
Here is one method:
Add this code to a CEWP below the list view.
Alexander
Use this for diagonal layout:
Alexander
Hi Alexander:
Thanks to both you and Larry for the vertical headers
Charlie
Hi there,
I just came across your site and wanted to say thanks for all the great articles. I don’t recall seeing an article referring to what I am looking for, so I thought that I would try to explain and see if there is a solution that you know of. I have a vendor contact form where enter the company, name, phone and a list of services that they provide (choice from a lookup column that allow multiple values). What I would like is to have is a view that would have each of the individual services listed and then list the vendors that provide that service. So a vendor might be displayed more than once if they provide multiple services. It would be similar what the yellow pages would display. For example the input would be
ACME Corp Electrical; Plumbing
Sunrise Co. Plumbing; Heating
Zap Enterprise Electrical
Output would then be
Electrical
ACME Corp
Zap Enterprise
Heating
Sunrise Co.
Plumbing
ACME Corp
Group by does not work with lookup or choice fields.
Any ideas would be greatly appreciated.
Thanks,
Scott
Hi,
I’m sorry, but i cannot think of a solution with a standard list view. It may be possible with an XSLT dataview (this is not my best area), or it could possibly be done with a custom made “list view” created with javascript and CAML-query.
You could then first query the “lookup source list” for all services, and then loop trough all services querying the list of vendors for which is providing the service – building HTML from the result.
I cannot give you anything more right now, but this may be looked at later on – very busy right now…
Regards
Alexander
Hi Alexander:
I am wondering if it’s possible to reorder the (.ms-gb2) 2nd “group by” field of a List view by ascending or descending “count” order, instead of Alpha (if it’s people).
ms-gb = month
ms-gb2 = person
Total is set to count items.
In my example, I would like to see the person with the most item “count” at the top and the others below him.
January
John (22)
Mary (19)
Alexander( 18)
Charlie (15)
Thanks-
Charlie Epes
Not sure if this got a response but I have resolved this by creating a calc column the add numerical value to month (01) January. That group by the calc. In my requirements I added year also because next year is different than last year.
Hi Alexander
Would it be possible to pop up a dialog box when a Yes/No field has been selected to Yes with a message and an ok button?
Regards
Andrew
Hi,
Like this:
Add to CEWP below NewForm or EditForm.
Alexander
Hello Alexander,
I have reorganized my form in 3 tabs schema and it´s working great, but at the second tab I have an specific concern:
I have 5 fields in the second tab but I would like to have the option to add a button below these fields that when I click this button would be possible to add 5 extra fields like the fields that I already have( I believe that they should have different names to not have a problem) and also an “x” or “remove” button to remove these 5 fields that I added there, like if I have created I new form clicking in a button, do you know what I mean?
My first idea was “ok I can do that integrating an ‘accordion’ in a tab”, so in each accordion part I´ll have the 5 fields. I tried to do that but I didn´t have sucess
I don´t know what can I do for solve that, is like if I already the fields in a hide situation and when I click in the button field they appear. I have a page in a intranet that has that and it´s a javascript solution that loads a jQuery library, could you help me with that?
Thanks
Hi,
I have not tried anything like this in a “tabbed form” and cannot be sure, but look at this post:
Dynamic expand/collapse fields or array of fields
or this one:
Dynamic expand/collapse fields or array of fields by multi select
and see if you can make something out of it.
The fields you want to add with the button have to be actual SharePoint fields, initially hidden.
Alexander
That helped me a lot 😉
I am using that, thanks Alexander
Hey a simple request
Is there a way to remove or hide the Ok/Cancel buttons only the ones from the top from a NewForm.aspx?
I wanna to keep the ok/cancel from the bottom and just remove or hide the ok/cancel from the top, is it possible do that without using Sharepoint Designer?
My main concern is that the ok/cancel buttos from top and from bottom has the same value and if you apply the code in one will reflect in another
Thank you very much
Renan
Like this:
Alexander
Thanks that solved this question 😉
Is there a way to create an anchor within a NewForm or EditForm? I have a long intake, or it could be long. When I assign the the item to an owner and provide them a link to the form, it would be easier to have an addition to the link with the anchor that links to a specific field in the form. Maybe a script that uses the fieldinternalname and converts that to the anchor name for simplicity.
Good Request Cookie:
I have often wanted to find a way to add “Bookmarks” to SP forms for that very reason… much like you can bookmark a Word Doc or PDF to specific regions of the page.
My need would require that I place links to each of the bookmarked form sections into a CEWP at the top of the form’s page so the user can skip right to the section he/she wants.
Charlie Epes
Look here for a possible approach:
SharePoint form: scroll to field as with an anchor tag
Alexander
I have been thinking about another possible request. I like your text to choice script pulling the items from a source list. is there a way to expand this so that the dispaly value is different than the return value? Like a standard select field you can have the display value something easy to read, but the value returned may be a number or a shorter version of the label. Maybe the source list has two columns, display column and a return value column. Almost like the yes/no field where that returns a number, but the user is selecting yes or no.
Hi Alexander
You are da man!! Thank you for the education, would there be a way in the new form of a list to populate the multiline text box with a default value, a html table etc….
Tony
Hi,
This code is for a list with three fields, one plain text multi line, one rich text multi line and one enhanced rich text multi line: FieldInternalNames: Plain, Rich and Enhanced. Adapt the reference to jQuery as needed:
Alexander
How would one adapt this to placing a default value in a hyperlink column and updating its description?
Thanks,
[moved by Alexander]
Sorry man added this to a CEWP and cant get it to work…..
The location is right because I have used it before, the internal name is from the source (I may of typed it wrong here)
Anything I am missing?
I call it using:
setMultilineFieldValue(‘Enhanced’,”Enhanced rich text”,true);
Besides the location of the library I changed the following
item.find(‘.ms-rtelong’).contents().find(‘Request_x0020_Description’).html(” + strVal + ”);
[moved by Alexander]
sorry context would be good the previous post refers to setting a default value to aehnaced multiline text box
I used your code as is just changing where i found the scripts and changed body to internal name of my field
Eliminated first 2 calls to function because we are only using enhanced and finally added this code to a cewp
Cant get it to work….UGH I am stupid ur a god, I am ugly ur good looking etc….
SORRY!!
Hi Tony,
Did you put the CEWP below the form? It has to be placed below for it to work.
Alexander
Hi tecrms,
The hyperlink field is nothing else than two input fields. Populate them like this:
Alexander
Alexander
While the text fields work correctly,
$(fields[‘MyHyperlinkField’]).find(‘input:first’).val(‘https://spjsblog.com’);
$(fields[‘MyHyperlinkField’]).find(‘input:last’).val(‘SharePoint JavaScripts’);
Crashes the page and I have to remove the CEWP. I then tried your basic script for filling in a text box with the following and it still crashed the page.
// autopopulate a field
fields = init_fields();
// Find the Title-field and insert text
// $(fields[‘Title’]).find(‘input’).val(“Insert this text in the Title-field”);
// Use the following to set HyperlinkFields
$(fields[‘MyHyperlinkField’]).find(‘input:first’).val(‘https://spjsblog.com’);
$(fields[‘MyHyperlinkField’]).find(‘input:last’).val(‘SharePoint JavaScripts’);
function init_fields(){
var res = {};
$(“td.ms-formbody”).each(function(){
if($(this).html().indexOf(‘FieldInternalName=”‘)<0) return;
var start = $(this).html().indexOf('FieldInternalName="')+19;
var stopp = $(this).html().indexOf('FieldType="')-7;
var nm = $(this).html().substring(start,stopp);
res[nm] = this.parentNode;
});
return res;
}
Any thoughts?
Thanks!
BTW MyHyperlinkField is the name of the Hyperlink field in my test list
Hi tecrms,
Some control questions:
Is it a unmodified form?
Is the CEWP placed below the form?
Does it work in another testlist?
Alexander
Some control questions:
Is it a unmodified form?
Yes, I started with a new library and only added the hyperlink column.
Is the CEWP placed below the form?
Yes
Does it work in another testlist?
Yes, It does work with a list form, but I am using a document library list form and that must be the problem.
I should have added what I am trying to do. I am trying to set a default link if one does Not exist.
Thanks for all your help!
Hi,
I have tested in a DocumentLibrary with this code:
The hyperlink Field is set.
Is there any other code that interferes?
Alexander
Your code is working now. The only difference I can see it the line >> if(typeof(fields)==’undefined’)fields = init_fields(); mad
The only problem I have now is:
if I update the hyperlink to some other path it resorts back to https://spjsblog.com
This code only updates if the field is empty:
Alexander
Alexander,
Thanks for all of your help! You Rock!
Hi Alexander
Sorry for the bother, would there be a way to have a cascade affect on dropdowns that are look up from other list
Tony
Have you seen this article:
Cascading dropdowns
Alexander
I am trying to create an accept terms script. I have a doc library and an Accept Terms list. When you enter the doc library I need the documents hidden and the list form for accept terms visible until user selects “yes” they accept the terms. 2 things need to happen. The accept terms intake is now hidden and the library is visible. I need the accept terms intake to have that electronic signature. Of cource if there is another way I am open to that. I also need to have the accept terms intake visible when the user has not accepted the terms. Something like I trigger a workflow to check back in six months and reset the field to force the user to accept the terms again. List form visible, doc library hidden.
Hi,
Interesting request. I will make a note of this one and try to come back with a solution. I cannot guarantee anything, but stay tuned and it may appear!
Regards
Alexander
I started working on this. I had my document library. I created a custom list with one field Choice Yes/No (required) and allowed content types so I could hide the title field. On the NewForm for accept terms I added CSS and Alexanders script to hide everything on the page but the one choice field and one set of ok, cancel buttons. I believe this would give an easy way to track initial accept. then your workflow can can run in the back to set your reminders.
In my document library I add a page viewer webpart, linking to my Accept terms NewForm. I am not 100% happy with this setup, but this is where my skills took me. Currently I ha a view with the doc lib at the bottom and accept term newform at the top.
I am working are trying to only show one of these at a time. default to NewForm until user accepts terms. May take me a little longer than Alexander, but it is a start.
Hi Alex,
I would like to ask you for help arround a big issue with keep session alive. I have appraisals done in sharepoint and the session timeouts on 10mins. To fix it i implemented a solution in an iframe “opening” a page on every 3 minutes, which in a way pings the server for a request. Now that works nice, except if the end user hits the save button in the same time as the script reloads/pings the server. Is there any way to implement anything to disable the save button before the page reloads and enable it after reloads.
I can’ enable bigger timeouts on the web app due to resources/RAM issue.
Regs,
Esad
You can disable the OK-button like this:
Alexander
Thank You, it works.
what is the line for disable a text field?
I tried this but not working
sorry for the bother, i got it:
[sourcecode]
$(fields[‘Title’]).find("input").attr(‘disabled’,true);
Yes I got it to work but I have a issue. I am populating the field with a query string value, I can see the value populated, but when I save the item, no value in the field. Have can i make the field read only, but have it save the populated value?
Sorry, set attribute to readOnly, not disabled. working now
Hi Alexander,
First off you rock! The Field side by side script was great.
I have a request. I have registration form and at the top it has an attendee section. I have it defaulting to the following three columns:
First Name
Last Name
Email
Is there a way to have a plus sign so that they can add additional attendees if needed.
Thanks in advance
He has 2 other scripts already post that may interest you
https://spjsblog.com/2009/09/10/dynamic-expandcollapse-fields-or-array-of-fields/
and
https://spjsblog.com/2009/11/28/dynamic-expandcollapse-fields-or-array-of-fields-by-multi-select/
Thanks , This is what I was looking for!
Wow, you get a lot of responses! Well, here´s one more. Have you tried to prefill a value in field control in a page layout? Or if you got an SharePointWebControls:RadioButtonChoiceField, that builds of a choice column, let say you have alternativs in the column and want to render the page with one of the alternatives. Another thing like this would to populate todays date in a datecontrol. Alexander, have you tried this?
Best from Christian
Hi Christian,
I’m not sure i understand what you are asking for. Please send me an illustration and i will try to answer. I do all my work on unmodified forms – i never change them in SPD, and therefor have little experience with xslt-dataview.
Look here: Set datefield to first day of month, today’s date or last day of month for some info on populate todays date in a datecontrol.
Alexander
Hi, thanks for your quick reply. First, if I have a content type that connect to a global column and this column is a choice (with checkboxes).
Then i use this in some page layout as a field control, and in SPD into the code among HTML (no dataview with xslt), the SharePointWebControls will be visible. This one I would like to modify like I can do with a SP list. I have try to modifiy this with Js with no luck yet, it seems to be different compared to ‘normal’ modifications with lists.
Drop me a mail if you like, I will send you some screencaptures that explains more exact.
Keep up your great work, thanks!
First, great site. I can use a lot of these tips on my current projects. Have you thought about using more categories in your posts so it would be easier to browse? Just an idea!
Do you have an ideas on how to remove “empty/blank” items when using the “group by” feature? See the example below. In other words, for category ‘Test 1’ you have to expand the blank item just to see the documents since they don’t have any subcategories assigned to them.
Example:
* Category: Test 1
* Subcategory 1:
– Document 1
– Document 2
* Category: Test 2
* Subcategory: SharePoint
– Document 3
– Document 4
* Subcategory: CRM
– Document 5
– Document 6
This is how I want it to work:
* Category: Test 1
– Document 1
– Document 2
* Category: Test 2
* Subcategory: SharePoint
– Document 3
– Document 4
etc.
Thanks!
Kale
Hi,
I have had many requests for easier overview of the posts… I will try to add some more categories.
Regarding your request it may be possible, but would require the script to “click” on the empty subcategory to load all the items, then remove the heading. I will add this to the “queue” and see if i can give you an example.
Regards
Alexander
Look here Expand empty subgroups and remove group header in grouped list view for a possible solution.
Alexander
Hi Alexander,
I’ve got a request about the possibilty to rollup events in a Gantt-view of a calendar.
The Gantt-slider (http://www.pathtosharepoint.com/Gantt/default.aspx) is a nice thing to have but all items are listed. I like to group the events by user name to show all planned holidays per user over the year.
Is there a way with javascript to be able to do that?
Thanks for your attention!
Regards,
Stefan
Hi,
I have not done any work on Gantt-views and cannot help you with this at the moment.
Alexander
Hi Alexander:
Is it possible for a Lookup field’s choices to show as Radio Buttons or Checkboxes on a form, instead of the usual drop-down?
Thanks-
Charlie
Hi Charlie,
It is possible for single lookups, but the lookup controls are rendered differently depending on the number of returned items (below or over 20 items). This is for single lookup’s and would work with radio buttons only.
The multi-lookup is another, more complicated issue.
I cannot help you on this right now, but might come back to it later.
Alexander
Boy you have your work cut out for you. Hope you are not getting overworked.
I am trying to figure out a way to count unique visits to a single page in a single day. Is there a way with jquery that can look at the UserProfile, identify the user on first visit, and tally all unique visits during the day?
On a grander scale, can the numbers or tallies be written to a list that tracks counts for multiple pages, by unique users?
Hi,
This would be possible. The “result” would have to be written to another list by a javascript-function.
Each page that is “counted” must be fitted with a CEWP with a script.
If i do this – would you prefer one line added to the “counter list” for every visit, or one line adding up all visits and presenting as a number in a column?
Alexander
Initially I was thinking that one line with count would be the best, but after thinking I believe it would be easier to just create a new line for each visit then can sort and group. This would also allow for other information like User, referring URL etc..
In my search I actually came across a SP WebPart that does almost exactly what I am trying to do. The major issue with this is it needs to be installed on the server and thats not happening here. The functionality seemed to be simple. Had a list with several columns. thatbe updated by alll groups and permission levels, including visitors and it displayed a counter on page.
http://hitcounter.codeplex.com/
Too bad this is not a web part I could install with a simple upload.
Hi Larry,
Sorry, but i had forgotten about this…
I will post the solution later tonight. It is actually quite easy!
Alexander
Hi Alex 🙂
Hopefully you will laugh at this one, I would like to add to the right of the field a verbage/icon that you can click on and get help not mouse over
As simple as opening a new page with info thats it….
For example click here for help and its opens a new window with explaination
Tony
this should take you about 90% of the way there:
https://spjsblog.com/2009/10/29/add-html-mouseover-tooltip/
Instead of writing text write a hyperlink to a popup. I have played with this script and have move the icon all around the cell, it is not difficult to figure it out. take a look and let me know.
sorry dude I am stupid i need all that to add a link to the right of the field that can be clicked on and opens a new window?
Hi Tony,
No, not stupid… Do it like this:
“Title” in line 5 is the FieldInternalName of he field to append the link to.
Alexander
Hi Alexander
How do you create the drop down toggle script to work if you have one drop down field that shows a field based on yes and no and another drop down that shows a number of fields depending on a numbers (1,2,3,4,etc)?
Thanks
Andrew
Answered here
Alexander
Have you written a script to create a slide show from an images library where you can control the order of the images? The default images library does not allow you to control the order of the images in the default slide show capability – it goes by creation date.
Have you checked out lytebox:
http://www.codeplex.com/lyteboxsp
also Christophe has a script here:
http://www.pathtosharepoint.com/Pages/ImageRotator.aspx
Hi Ben,
I have not done anything like this. Look at the links provided by Larry.
You may place another request if you do not find what you are looking for, and i will look at it if i find time.
Alexander
I see you are busy and I just keep adding. I will help out on your questions as much as I can. I have a New request. In a grouped view, if grouped by a people picker SP displays their account name. Can this be switched or swaped with their display name?
example by default:
DomainFLast
change to:
First M Last
Hi Larry,
Thank you for helping out in answering questions – nice job yesterday.
This has to do with the “information type” selected in the list settings for the people picker. You can change it there to “Name”.
Alexander
My problem is these Items are added by a workflow create new ilist item. The only way to ensure name to be written, I need the Account Name meaning I would continually need to switching them back an forth. Can we modify your script to access user profile and swap the account name with display name?
Hi, if we have one particular field in a list, and want to clean up empty spaces in that field, something like
field.value = (field.value).replace(/^s*|s*$/g,”);
do you have any ideas here?
Hi,
Is this a NewForm/EditForm? Single line of text?
Alexander
This code strips off all leading and trailing whitespace (uses the regEx you supplied):
Place in CEWP below NewForm or Edit Form (read here how to do that);
Updated: Missed “return true” in the function PreSaveAction()
Alexander
I want to edit this to force numberical valuse on a singleline textfield. reason is I dont want commas.
What is the expression?
instead of val().replace
if the expression != numbers
alert(“”);
else
ok to save
this should be fairly easy. I am going to search for the regex. and try to produce it. if you have any suggestions they are welcomed
Larry,
This regEx should do the trick (only numbers 0-9 is allowed):
myField.val().replace(/[^0-9]/g,”);
Alexander
that actually replaces the value with blanks, no alerts. If I want to set length = 9; and alert the user to make the changes I would need to compare. I cannot figure that out.
If not Num and not length = 9, alert user, no save
Hi, a single line of text and I think that would be good in both Newform and Editform, but most valuable for the Newform.
Thanks!
On the choice menu there is an option to allow user to Specify own value. is there a way to replace the text “Specify your own value:” and hide the field until the radio button for this is selected?
also on the reverse, when the option for Specify own value is selected, hide the original dropdown.
hiding the original DD may cause an issue. I think hiding the textbox until other is selected wold be a better functionality. remember specify other value is used for checkboves also.
Hi Alexander:
I need my users to click an “Add New” icon next to an item in a List View and have a NewForm pop-up with the same [Company Name] field already populated. Possible?
As always, Thanks-
Charlie Epes
This can be easily doone with a calculated field and Christophe script Text to HTML here:
http://blog.pathtosharepoint.com/2009/11/19/html-calculated-column-minor-update-and-some-advice/
if you need help writing the calculated field let me know I can help with that
There are also a few script, think I have one for the NewForw to populate a field from query string. We can wolk thru this step by step if you need the help
Hi Larry:
I’m very familiar with Christophe’s html calc field but how can I work it into this scenario?
I need to be able to grab a specific field from the first list.
Charlie
calc field:
=””
Now you have added a querystring value ClientVal. On the new form you can grab the ClientVal and add it to a field
sorry here is a sample calc field you could use
Hi Larry:
Ok I’m using Christophe’s solution for opening in a new window :
http://blog.pathtosharepoint.com/2008/09/01/how-to-open-hyperlinks-in-a-new-window-or-not/
The [URL] Formula I have is:
=CONCATENATE(““,Title,”“)
Do you know how to pass through the Title from one list to the NewForm?
Charlie
Hi,
If you use the method described by Larry, you can grab the querystring “ClientVal” from the url with parts of the script found here:
SharePoint form: scroll to field as with an anchor tag
Like this:
This code gets the parameter “ClientVal” from the queryString and inserts it in the “Title” field.
Alexander
Hi Alexander:
Coach me a little on this. I have my html calc column all set up like Christophe had. Where do I insert your script? a cewp on the List view or on the new form?
Charlie
One more questions:
My Title field is named “Company Name”. When I insert ClientVal=”&Company Name&”, I get “not support syntax.
When I insert “ClientVal=”&Title&”, it says it refers to a column that does not exist.
Do I have to insert the title field? Am I inserting the internalfieldname or the shown name?
Thanks-
Charlie Epes
Sorry. I put Company Name in as [Company Name] and it worked beautifully.
Thanks-
Hi Alexander:
I think this solution is worthy of a blog post!
Perhaps, “Open Duplicate-Title List Item in NewForm Window”.
Anyway, you and Larry helped me immensely today-
Charlie Epes
Hi Alexander (and Larry):
Small issue, but which ever image I use from the SP image gallery, the List View with the html column puts a heavy blue or mauve border around the image.
I know the color shows if I have previously clicked it, but is there a way to get rid of the border so the image appears as clean as the Edit icon?
Thanks-
Charlie Epes
Try this: add border=”0″ in your image tag
Thanks Larry. That works perfectly. I appreciate your help
Charlie
Hi Alexander:
Coach me a little on this. I have my html calc column all set up like Christophe had. Where do I insert your script? a cewp on the List view or on the new form?
Charlie
the script should be placed on the NewForm. this is where the query string is available, you will see in in the URL, Alexander’s script will grab it from there and write it to your field.
You guys are wonderful!!! This is tremendous…. Thank you –
Charlie Epes
Hi Alexander,
this has been by far the most informative resource I’ve read today and combined with Christophe’s site it’s a valuable addition to my favourites list.
I’m a sharepoint newbie but found myself somehow as one of two designing an internal site for our team. We thought about different opportunities to set up the site, though one thing was clear, we wanted to get rid of the typical explorer like folder structure and nesting.
Our idea sounded simple and logical, however today we learned that it might not work at all.
Instead of having multiple document libraries for different access levels we had the idea to incorporate a “visible to” column to define access by using metadata information.
The plan was to have e.g. team1 and team2 have read/write access to a doc library and each of them would only see documents tagged with the relevant visibility level. Turns out that we can’t restrict the visibility based on access level since there is no obvious way to match metadata against a group/role.
Since we only have site admin access our only help would be a cewp doing some sort of lookup of the user/group trying to access the doc library matching against the metadata column. The column can contain multiple values.
Do you think that it might be possible to solve this with some javascript code and point us into the right direction?
thanks
Chris
endusersharepoint.com had a neat script that allowed you to create folders with permissions based on views. Since they moved their site some of the items have not yyet been posted. I will try to find the original post. I think this can help you. Give me a day to find it.
I found the post. This may provide the permission level by views you are looking for
http://www.endusersharepoint.com/2009/01/14/automatically-switching-views-when-opening-a-sharepoint-folder/
Hi Chris,
I will write an article about this. I have had the same requirement myself, and have the scripts already made.
The method i used involved reading the “team name” from the user profile (the WSS profile or the MOSS SSP profile). You can also read the team name from a cookie.
I then take the team name and uses JavaScript to filter the view based on the value in the “Visible to”-column. This column must be visible in the view for filtering purposes, but the script can hide the column if desired.
By using another of my scripts, you can filter the list based on group membership.
This method have some limitations regarding grouped views. I will describe them in the coming article.
One other method for filtering a view is by using the URL-filter. This method is very god as it does not require the column to be in the view.
The disadvantage of the URL-filter is that the filter must be included in the link for it to be applied without refreshing the page.
I cannot promise a delivery date, but will try to get it done by the middle of next week.
Alexander
Larry, Alexander,
thanks a lot for picking up on this topic. On friday we tried a possible workaround using views but we weren’t able to restrict access to the other views nor the document library itself. WSS would always asign read to the document library if read was set to a specific view.
I’ll have a look at the eusp link and I’m definitely looking forward to reading your article, Alexander.
Again, thanks a lot for your help!
Chris
Larry,
I’ve read the description on eusp, but I can not find the script? Is there a trick to it? There’s only the “…add in the following script:”
And then an explanation on how the sript works, but no code?
Chris
I have this replicated some where and I posted a request for the script at EUSP. Sorry taking so long but give me some time to track it down.
Hi Chris,
Here is my attempt to answer your question: Filter list view based on membership in SharePoint group.
Alexander
EUSP updated their post, the script is available
http://www.endusersharepoint.com/2009/01/14/automatically-switching-views-when-opening-a-sharepoint-folder/
Larry, thanks again, will try that tomorrow!
Chris
Thanks Alexander, will try it in detail tomorrow. So far I had no luck in getting it to work, I’ve downloaded a copy of jquery 1.4.1, changed the path/version but nothing happened.
Is there a chance that this will work in doc libraries, too?
Chris
Hi,
haven’t been able to get this to work. I don’t even know if the jquery part works or not since I don’t know how to verify this. Is there something I can insert into the code that will give me an indication as to wether or not the script is actually called?
Chris
To test if jQuery is loaded, insert this in the code:
This should give a dialog with a three line function in it.
Alexander
Thank you for all of your help!! Quick question hopefully, you showed me how to open a new window for help, how could I place that next to the display name? Is it even possible?
$(fields[‘MyField’]).find(‘.ms-formbody’)
.append(“What information do you need to provide?“);
Tony
Like this:
$(fields[‘MyField’]).find(‘.ms-formlabel‘)…
Alexander
Hi Alexander!
I have a multi-line text field I want to allow users to update in a datasheet view. The problem is that they can’t add multiple lines of text while in datasheet mode. Any ideas on how I can give them this ability?
Thanks!
Amy
Hi,
You can edit multiple lines of text in datasheet – not enhanced rich text, but both plain text and rich text are editable. Is it the linefeed (Enter key) that is the problem?
If so, use Alt+Enter for linefeed – like in Excel.
Alexander
hi alexander
is there away to display html to the right of a multiline text box? not below but actually to the right?
Tony
Hi,
Is it in DispForm or EditForm? – or other location?
Alexander
newform
Like this:
Alexander
Hi Alex,
Does anyone know how to hide column display names on sharepoint forms?
Using Alexanders script here you go:
Usually I use this in combination with writing new labels.
Here I replaced line 5 from above with this:
Hi,
Just remember to refer the jQuery script as well.
Alexander
Hi Alexander, I did not succeded wiht the code that strips off all leading and trailing whitespace (and use the return true), have for example a complete new custom list with only a default Title field, and have the link to the latest min right, and have the CEWP below. Some idea?
Check that jQuery is loaded with this alert:
alert($);
It should give a dialog with a function.
Alexander
hi Alexander,
i accidently stumbled on your great blog search for a way to modify my lsitview with javascript.
here’s what i would like to accomplish:
i have this allitems view with multiple columns. One of these colums is of the multi lines of text.
When i start editing my items my multiline column cell strats growing in size due to a point that i can only see one item in my screen and need to scroll down to see other items in the list.
Is there a way to limit the number of characters in the multi line column (named “Voortgang en resultaat”) to show less characters: preferably one line of text or text up until some splitting character?
thanks,
ronajon
Hi,
I have made a solution that should fill your need: Multi line text field in list view: Shorten text and add hovereffect to view full text
Alexander
Hi, thanks again for all nice posts here, always intresting stuff here!
I try to figure out how to change the output text for the standard buttons in a newform.aspx, i want to change OK to Save for example. Have tried the ‘replaceWith’, but I don´t know how to get the text when it´s a value? Any ideas here?
/C
Hi Christian,
Refer jQuery and do it like this:
Alexander
is there away to vote up or down a request, for example a list with a thumbs up or down next to each item that u can vote for once
Tont
Hi, works perfekt, and I noticed that SaveItem was the absolute last part of the ID for the button, as I can see in IE dev toolbar, like GoBack was the name for the Cancel button. Smooth. Thanx Alexander!
choice – Multiple select, check boxes, is there a way to have multiple default values. I may want the same 3 items to always be selected. by default SP only allows one option. This field for 90% may need those 3 requests. Can it be done?
Like this: Multiple default values in a column of type “Checkboxes”
Alexander
that was great
Are you passing on that accept terms request? I went back to review it and can’t find it.
You have to click “« Older Comments” at the bottom of the page. The article is in the queue, but there is not enough time…
Alexander
Hi Alexander great job by the way
How can we implement the thumbs up or down functionality you have on your site to a sharepoint list?
Tony
Hi Alexander & Larry:
I was hoping that I could use borrow some advice & suggestions from both of you on the setup and output of a SharePoint List.
I have Alexander’s email, but Larry I am wondering if I might email you too. My email is charlie dot epes at fnrm dot com.
Thanks-
Charlie Epes
Buffalo, NY
If its in general interest you may put it here, otherwise email me.
Alexander
I know you had a post related to people picker fields and populating other people picker fields from an external list. I want to tweak this.
3 single line text, first field (uses your script text to choice) to get value in external list, field2 and field3 auto populate. I just cant get this script converted. How can this script be changed to text fields, first field is text to choice. is is a quick change?
Is what you want to insert the returned value in a text field rather than a people picker?
Alexander
Yes text field. What I can’t figure out is what to change so when choice field1 or text to choice field1 on select populated fields 2 and 3.
Hi Alexander:
Further to your Multiple Choice Checkbox solution, do you know of a way to add a “Select All” to all checkboxes on an entire form?
Thanks-
Charlie Epes
I will take this one. I am documenting it now. Will ppost it here when done, if Alexander wants to move it that will be ok.
Larry
In your choice field (checkboxes) add a value “Select All”
add CEWP with this script
just update to reference to jquery. I have been able to run this with the code above and below the NewForm, EditForm. This probably could be tweaked a little cleaner, but it works very smooth.
If anyone is interested, when dealing with Forms library there is a repair or relink action. again depending on the amount of documents could be many boxes to check. I have adapted a script to add a select all on that page also.
You find a possible solution here: Add “Invert”, “Check all” and “Uncheck all” to a multichoice checkbox column or the entire form
Alexander
I have been trying to setup a blog. How do you get the script to display the way it does? is it a plugin? is it privately hosted?
This is standard functionality at wordpress.com.
Alexander
Thanks,
it must be me because I cant figure it out.
Hi Alexander great job by the way
How can we implement the thumbs up or down functionality you have on your site to a sharepoint list?
Tony
Hi,
I will take a look at this when i find the time. I think it would be possible either by writing the rating to the item itself, or by writing to another list.
I unfortunately have little time to spare, so i cannot promise anything, but i have added this to the queue.
Alexander
Here is a possible solution: Ratings for SharePoint lists
Alexander
Hi there hope you can help!
I need to get working – highlighting a row in SharePoint when the mouse hovers over it and when clicked on, selects the row entry displaying the dispform.aspx page.
I have achieved this through Sharepoint Designer but really need it to work on a normal SharePoint list.
Christophe got the highlight to work I noticed but I really need the dispform.aspx page displayed when clicked on anywhere along the row.
Again – hope you can help!
Take a look at these articles and see if that helps you on the way:
Highlight row by value in Yes/No-column
Preview metadata in list view on mouseover
Alexander
I am trying to disable OK button if choice equals “No” and enable if Choice equals “Yes” (not Yes/no choice, Radiobutton choice). here is the code I have. I took it from part of your dynamic hide show multiple select. Can you tell what I am missing?
Sorry again, I figure it out. anyone interested I will post the solution.
Thanks Larry great post
Larry I would like to see the solution
Disable Choice option until Yes is selected:
Here you go:
Not disable choice, disable OK until choice option is Yes
forgot the most important part
thanks Larry Great Post!
Hi Alexander,
I trying to create a search field to search a document library. Any suggestions?
Here is a great post for a library list filter. Peter Allen is as amazing as Alexnder. http://www.bitsofsharepoint.com/BlogPoint/Lists/Posts/Post.aspx?ID=54 if you dont like this I have a script, cant remember where I got it. It creates a text field at top of each column, type in any field and it filters also.
thanks Larry I will give this a try but if you come across your script I would like to see it. your script is exactly what I would need.
The only thing I was not able to figure out was how to remove the google fnction and replace with direct link to jquery
Thanks Larry This works great!
Hi,
I only wanted to link back to the author of this script: Jaap Vossers’ SharePoint Blog
Alexander
Thanks Alexander, I thought that was on another blog and it was bugging me not remembering
Hi there! I need a script or any solution in SharePoint to just display a note/comments. Is there perhaps a script that can hide the response field on a form so I could just display the column title with the note/comments?
Hi,
You could use this solution: Headings for SharePoint forms – another method
Alexander
Hi Alexander! Another challenge for you, i´m searching a way to make a document library automatically name the new folders created sequentially, i mean, the first folder´s name would be 001, the second one 002,… Do you think that could be solve using script?
I hope you can help me! thank you very much! 🙂
Sorry, i can’t help you with that one.
Alexander
I have list view. On above I want to give 3 control i.e. StartDate (Datefield), Enddate(Datefield), Checkboxes (Choice field) and a button i.e. “Search”. I tried with SPD, but not happy.
First I want to validate that Start date shounot be >= Enddate after selection, user will select checkbox value (can be more then 1)
Then user will click on Search button thne records will filter depending on selected criteria and display in view.
Please advise
A far as i know you cannot filter a standard SharePoint list view based on on a date range. At the moment i cannot provide you with any solution, sorry.
Alexander
I have 1 transaction List which has various fields, out of them 2 fields i.e. Name and Type (choice field) I want to generate a cross tab report. Where Name display vertically and type display horizontally.
Please help me out, I am not sure how to do it
Name1 Choice1 – Choice 3 Choice 4 –
Name2 – – – Choice 4 –
Name3 – Choice2 Choice 3 – Choice 5
Name4 Choice1 – Choice 3 – Choice 5
Hello Sir
Can you please help me to implement this?
Avi
can you provide a screen shot of what you are trying to achieve. I believe I think I understand. Looking at what the text displays its a bit difficult. is Choice1, Choice2.. fields or options of a field? I believe this could ne accomplished with a calculated field.
Lary
Choice1, Choice2, Choice3.. fields are a values of a “Work Type” field, its field type is ‘Choice’ it is displaying as Checkboxes with multiple selections.
If we discuss about functional logic i.e. Which Contact(Name field) is eligible for which work type, which we have normally set during new record creation.
Let me know if you need more information.
is this something like what you are looking for:
http://home.comcast.net/~larry.h.pfaff/output.png
You are great man, that is what I am looking for.
I’ll post solution tomorrow
Thanks
I spent a good poprtion of the day trying to work this out. I came very close. the problem I was having is with the multiple select. I am having problems reaading part of the string. If it was only for single select we would be done. With the use of calculated fields, HTML and Christophes script HTMLcc we could create a proof of concept. I will contine to tinker. Maybe Alexander will come up with something.
Today is a new day and I actually made some progress. this is my results today
http://home.comcast.net/~larry.h.pfaff/optionChoice.png
almost there
Okay I have finally achieved proof of concept. I started out with the two fields you had
– Name
– WorkType
Set WorkType to single line field
Created a calculated field “calc”
set it equal to WorkType.
Now WorkType must be deleted, then recreated as your choice, multiple select field. this is the only way calc returns the values in WorkType as a string. calc wont read WorkType unless you trick SharePoint.
The next set of fields depends on the number of options you have. I did it with 5 options so i created 5 calculated fields
opt1 =IF(FIND(“Choice 1″,calc),”Choice 1″,””)
opt2 =IF(FIND(“Choice 2″,calc),”Choice 2″,””)
opt3 =IF(FIND(“Choice 3″,calc),”Choice 3″,””)
opt4 =IF(FIND(“Choice 4″,calc),”Choice 4″,””)
opt5 =IF(FIND(“Choice 5″,calc),”Choice 5″,””)
The formulas are searching the string for that value. When you setup yours Choice 1 would be your option 1, same thing for the returned value if true.
As it is it returns the values in each column as iut should , but the find formula returns #VALUE! it the formual is false. I looked at a script and placed it on the page to do a string replace.
In a CEWP under the list view add this script
it is not jquery, but if someone wants to convert it I would be okay.
let me know if you have any questions
Larry
Thanks for this. I appreciate this and agree that without calculated fields it is not possible. That means need to create 5 calculaeded fields thne why do I need implement yout script.
I can create simple view with following fields Iwith yes/no option) and it will display horizontally.
Name
Option 1
Option 2
Option 3
Option 4
Option 5
What do you think?
Hi Avi,
Is the result Larry presented what you want?
To take the selected options from a multi choice and insert them in separate columns. You would then have one “Plain text field” for every available option in the multi choice?
What is the end result you want? – to filter and sort by the values?
It is a bit unclear to me actually what you want to achieve – that you do not already have in a standard list view.
If you provide an illustration of what end result you imagine, i might be able to help.
Alexander
Avi,
You right about why not just create 5 yes/no fields. Thats not what you asked for. So I worked this a little more and the solution I came up with works with 2 calculated fields now and your options are in a table format.
I was able to figure out the calc formula that did not return the #VALUE! on error.
you still need to start out the same way. set WorkType to Single line text.
Create field “calc” = [WorkType]
change WorkType back to choice multiple select
Create a calc field with this formula
for this code to work and display a table you will need the script text to HTML from christopthe site here:
http://www.pathtosharepoint.com/HTMLcc/default.aspx
Lary
Thanks, this is what I am looking for.
How can I used in new custom page? I have added CEWP, but how do I pass the list reference with this code?
Again thanks a lot.
Avi
passing the list reference is different then populating a calculated field. if you create this function in a list, then anywhere you display this list, the calc fields will also populate. this layout is for the output on your list views, or the dispform.aspx page, to convert the HTML to display, this will be placed into a CEWP below the list or below the list form. follow the link for the scipt and there are instructions on how implement
Hello
I have tasks list where we are assigning task to different staff persons on different dates. For assigning we are not using using people / group field type, we are using a calculated text field (First Name + ” ” + Last Name).
I want to display weekly calendar with next/previous navigation and schedule of each staff link as shown below
Initially it will display the weekly calendar with staff name under each
day column, but once user click any staff link name from the left menu weekly calendar then selected staff task will display in the weekly calendar
Is this possible?
——————————————————————-
Staff | Week of <<>
| Mon Tue Wed Thu Fri
| —– —- —– —- —
… | —– —- —– —- —
| —– —- —– —- —
| —– —- —– —- —
Calendar Look Like
————————————————–
Next Week Previous
————————————————–
Staff Mon Tue Wed Thu Fri
Staff1 — — — — —
Staff2 — — — — —
Staff3 — — — — —
…
…
Sorry, but i do not think i can help you with this one at the moment. I have done very little modifications on a calendar view.
Alexander
Hi Alexander:
One of my wishes is to be able to print Lists to paper and be able to set the column names and perhaps the banner of a List view as repeating page headers on the printout.
I imagine that JQuery cannot control a printout but perhaps it can divide a list view into selectable lengths with the column names so the printing it would mimic an Excel prinout with headers.
Footers on each page would be great too!
Charlie Epes
Have you seen the jquery plugin at eusp
http://www.endusersharepoint.com/2009/04/06/jquery-for-everyone-print-any-web-parts-plugin/
Hello
How can I add more menu option in list toolbar alongwith url reference and image?
Thanks
You may want to check out Jan’s blog. He has done some great work with menus
http://weblogs.asp.net/jan/
I’m not quite sure where you want this menu, and what is it supposed to contain? – static elements or dynamic elements?
Alexander
Hi Alex thank you for all your great work, you showed me how to add a help link after a rich text box, is there away to add it right after its title/name? For example filed name is description and have it appear like:
Description (Click here for help) and then the field…….
Tony
https://spjsblog.com/2009/10/29/add-html-mouseover-tooltip/
He also had a simple title tool tip, I am sure the text could be converted. or can try this
this is Alexander,s script
sorry adding to the last request i am using your code and have it as a single column, hope that doesn’t make a difference
Hi,
Wondering if anyone has figured out a way to create a cascading dropdown where the child dropdown is a Person/Group type field… e.g. Team and Team Member.
Any guidance is appreciated.
Travis
Where would you pull this information from? – a separate list as in my Cascading dropdowns script?
Alexander
Hi Alexander,
Yes, that was my thought… to have a separate list as most cascading lookups I’ve seen implemented… so:
Cascade Reference List Columns:
Team Name (Text, Dropdown, or Lookup column type)
Team Member (Person column type)
Make sense? Any idea how to accomplish something like this?
Thanks,
Travis
The cascading dropdowns script i have made can have a person (from a people picker field) on the last dropdown.
This script relays on single line text fields rendered as dropdowns, and cannot insert the “picked person” in a “picker field”.
Alexander
Hi Alexander:
Similar to your “Today Date Picker Clicker”, I am wondering if you know of a way to click yes/no in a list view.
I have a list with 31 choice fields with options of Yes and No (NOT a Yes/No check box). I would like a user to be able to click yes or no on the list view “cell” beneath the field. Clicking once would mean Yes, clicking again would leave it blank or No.
I know your today date picker was placed on a newform/editform. Is this possible on a list view?
Thanks-
Charlie Epes
Scratch that… I would be happy with the Yes/No check box field type being clickable on the list view, so it’s either on or off.
Thanks-
You have this script: Edit date, single line text, number or boolean columns directly in list view. It cannot be used in a choice field, but for a Yes/No-field it should do the trick.
Alexander
Of course. Thank you –
Howdy,
How would I go about a simple tool tip for a ordinary list. I can only use Java Script within a CEWP. I am trying to notify the user that when then hover over any item of the list that “Click to Filter”…I am using connected lists that filter and provide data to each other.
do you want a tool tip for a single cellin a row, or for the whole row?
For a single cell this can be done with a calculated field and a hyper link like this.
[sourcecode]
="<DIV><a href=’#’><img src=’help.gif’ title=’tool tip here’></a></DIV>"
to make this work your need a script from Christophe at pathtosharepoint.com here:
http://www.pathtosharepoint.com/HTMLcc/default.aspx
If you a more dynamic tooltip, I found this one to be pretty good and can be implemented into the calc field formula above
http://www.walterzorn.com/tooltip/tooltip_e.htm
Hi,
To add a plain text mouse over tooltip to the entire row, add this code to a CEWP below the webpart. You will have to identify the id of the WP you want to add this tooltip to, and replace “WebPartWPQ3” in the code.
Use IE Dev Toolbar, or FireBug for FireFox to inspect the code.
Alexander
Hi Alexander:
Another “is it possible?” question…
Is it possible to have a specific column’s filter choice appear in a CEWP that I would place above a list view?
Example: Filter the page by [Customer]
CWEP: would contain text + [Customer]
Thanks-
Charlie Epes
Like this: Show active list filter above list view
Alexander
I also have same type of question but slight different.
I want to filter my list by 3 inputs i.e. Start Date/End Date and Checkbox field.
I will ask user to select start date/end date (with validation of start date should not >= end date) and a 3 checkbox (leavetype) i.e. casual, holiday, medical and a go button
In the list I have requesdate and a choice field of leavetype (which allows user to select multiple value)
Now once user enter start date, end date and select 1 or multiple chackbox, my list should populate.
Is this possible?
Hi,
This one answered in another comment above, and i have to disappoint you:
Alexander
Howdy!
Hi Alexander, how are you doing? I haven’t seen any posts related to this, but please correct me if I’m wrong…
Is there a way to change the background color of specific fields in a list view using jQuery? I’ll give you a sight of what I need:
There is a table with the weeks of each month… side by side.. and the users must select a range of weeks that they’ll use for vacation. The fact is, my manager asked me to have the filled fields with a background color (blue for approved vacations and red for rejected ones). I hope I could get you the Idea. Well, thank you very much for the attention =)
Victor
Hi,
Take a look at this one: Highlight row by value in Yes/No-column.
Let me know if you can use this approach.
Alexander
Hello
I have two choice fields, 1 drop down and another is multiple radio buttons (6 values/radio button). This I want to implement on newform/editform
In dropdown I have 3 values i.e. Yes/No/Not Sure (selected by default).
I want to show/hide some of the radio buttons out of 6 radio buttons depending on condiion.
Let say
if user select “Yes”, then show radiobutton1 and radiobutton 3
If user select “No” , then show radiobutton2 and radiobutton 5
If user select “Not Sure” thne show all the radio buttons
How can I do this?
Hi,
I have written up a solution and will post it later today, or during the weekend.
Alexander
Here it is: Filter Radio Buttons or Checkboxes based on selection in another field
Alexander
new request for you. Character/word counter for multiple line field to display below the field. Not general for all multiple lines, but setup in a way that can set fieldinternalnames in am arr. also can we add a character limit, so user can not enterany more text.
I have several character counters. cant get it on the form. I am also looking into adding it on the create field page. calculated fields can only accept about 1000 characters. would like a way to display the count on that page.
Like this: Add character or word count to SharePoint multi line plain text field and restrict input length
Alexander
Hi Alexander
I have a drop down field in a sharepoint list which is populated with long selections. When the NewForm and EditForms are viewed on screen they require scrolling right to view them. Is there a way on the form of showing a number of characters with the … after?
Thanks
Andrew
Add this code to a CEWP below the NewForm or EditForm. The FieldInternalName of the select in the example is “MySelect”, you must change this to match your field.
On mouse-over on the truncated text, you get the full text.
Alexander
Is there a way to capture the IP address of the computer when a user is submitting an item in a sharepoint list?
Not with client side javascript. You must use server side code. I do not have any examples of such code, sorry.
Alexander
In a Custom Workflow users edit their Tasks associated with this workflow.
In these Tasks there is an option for them to enter a comment in a Comments field.
Is there a way to show this Comments field on the WrkStat.aspx page?
Also, is there a way to highlight the Outcome field if it is set to Approved or Rejected?
e.g. green if approved or red if rejected.
Hi,
A modification on this page must be done on the server. This page is shared between all web applications running on the server. I cannot help you with this one, sorry.
Alexander
eru, I’ve played with this before, and you can build a dynamic string (comments) and write it to the workflow history log. You may have to play with formatting.
I know this topic has come up before and I have pointed users toward other posts. Hos to do with filtering a list. there is a pretty good script out there that applies text boxes to each column and it filter on entered text. Today I was looking in to changing the textfields into dropdowns. Then i came across this webpart that creates a form at the top of the list and it has a date span filter. very kool. Even if the date span can be achieved thru jquery. is there a way to create a form that pulls data from multiple columns in a list and then can filter on select? What I think is a key featuer is the multiple select filter and right above the list.
http://www.kwizcom.com/ProductPage.asp?ProductID=404
It is possible to do some of this with javascript, but I’m kind of overloaded and cannot help right now. I may come back to this.
Alexander
Yes back with list filters requests. Is there a way that a user can hide columns of choice? Just like the script in my last request post that displays text fields maybe display check boxes. When the box is selected the column is hidden leaving only the checkbox. Unchecking shows the column.
With the above list filter script I found when user filters you can’t export that filtered view. The export exports all the data. Is there a way to have the dynamics filter and it retains the filert view on export?
Hiding columns is possible, but as i stated above, I do not have the time to do it right now. I might come back to it later on.
The export issue is not possible to overcome i think.
Alexander
I am sure you are busy. No worries I know if you have the time you’ll knock it out. I have been slammed myself, please don’t give it a second thought.
thanks for all your efforts
Awesome Blog! I’ve never seen such a collection of useful enhancements!
I am having trouble converting my Excel powerusers to Sharepoint due to certain limitations. I hope you find some of these interesting:
List View Issues:
* Freeze Panes – ability to freeze the first column and/or the top row in a List View (I’ve seen solutions for top row, but not first column, or both)
* Column Heading Tooltips – something like adding “comments” to cells in Excel. Could come from the field Description? Would display onmouseover.
* Count/Sum/Average Calculated Columns – I’ve seen a solution for one column, but not multiple
* Draw Column Lines – draw a line on the left or right edge of a column to have visual separation between blocks of columns
* Color Column Headings – color column headings to provide visual separation / grouping of columns
* Third Level Grouping / Sorting – (or more)
New/Disp Form Issues:
* Field Coloring – color field labels to provide visual separation / grouping of fields (in conjuction with above Color Column Headings)
* Horizontal Separators – a line or other visual way to separate / group blocks of fields
Frozen headers:
http://kjellsj.blogspot.com/2009/06/sharepoint-jquery-scrolling-view-with.html
Column attributes:http://kjellsj.blogspot.com/2009/06/sharepoint-jquery-setting-td-column.html
You could easily modify this code like this to fit your needs
Take a look here for color coded separators between sections in a view: Headings in list views. It is a bit outdated, but it works.
Read about headings in a SharePoint form (NewForm, DispForm or EditForm) here
I will make a note of your requests, and try to post solutions to some of them. I’m a bit busy at the moment and cannot promise a “delivery date”.
Alexander
Sorry, I hope its not greedy to post multiple requests. This one is not related to Excel deficiencies.
I need the ability to generate an html email, formatted just like the ootb alert email, by clicking a link or button contained in a List item column. The email would open in my email client (like Outlook). The TO: field would be empty but the Subject would contain the text of the List Item Title column. Here is the use case:
I have a List that contains change request items. I need to “forward” a single item to a resource on my team and include comments like “hey, why is this taking so long”, or “please log in and approve this request”. I want the email I send to appear like the structured alert emails that Sharepoint already sends so that its very familiar to the user, has all the same “View Item” and “View List” links at the top, etc.
A Calculated Field could generate a mailto link using this script HTMLcc you could get the functionality you are looking for. A simple formula like this should get you going.
http://www.pathtosharepoint.com/HTMLcc/default.aspx
I have made a note on this, and will write an article, but again: I’m very busy so it may take a week or two.
Alexander
So sorry. I forgot one key Excel feature that is missing in Sharepoint Lists. My users need the ability to do Excel functions similar to MATCH or VLOOKUP in Sharepoint. So the (somewhat confusing) use case would be:
List1 contains change request items. List2 contains release information including the Deployment Date. In List1 I have a Lookup to the Release Number field in List2. I need to be able to select the Release Number in the Lookup field drop down, but retrieve the Deployment Date instead for inclusion in List1.
The catch is that this association needs to be dynamic. So if I change the Deployment Date in List2, it changes in List1 as well (like Excel).
This is actually what I’m working on right now. It will hopefully be posted this week.
In your example it would be possible to make a calculated column in “List2” with a code like this:
And use this field as source for the Lookup in “List1”.
Alexander
Hi Alexander:
Is it possible to force every hyperlink in EVERY CEWP on a page to open in a new window?
Thanks-
Charlie Epes
I am sure with script you can limit it to specific CEWP. For a standard open in new win
Hi Larry:
Do I wrap this in JQuery or Javascript?
Thanks-
Hi
This code handles all external links in “ms-bodyareacell”:
Alexander
Hi Alexander:
Thanks for the code. I can’t seem to get it to work. I’m replacing my JQ url, and I’m placing this inside a CEWP at the bottom of the page. What might I be doing wrong?
Charlie Epes
My fault… Thank you very much. This is a huge help!!
Charlie Epes
Yea, I have a big page of links and I would love to have it automatically open in a new window instead of asking/pushing the user/admin of the site to add the code each time.
Thanks-
then you can try this, but will still requre it to ne inplemented on each page.
Get your weppart ID and update it below
I have a button and a textArea field on a SharePoint page. When I click the button I want it to insert Today’s date into the textArea field. (NOTE: the name/ID of the textArea field could be anything because the user will add this to a SharePoint list).
I have made the button appear on the Enhanced Rich Text Editor toolbar that appears on comments fields that are of type ERTE – Enhance Rich Text.
I know how to generate the date but I am having trouble identifying the field on the SharePoint page so that I can set the value of it to the date. I also know how to identify the textArea field if the name is constant but when it is added by the user the field name is random.
Do you know how to do this?
scroll 1/3 the way down A responed to a request with a script to setMultilineFieldValue that help get you started
https://spjsblog.com/2009/11/05/requests/comment-page-3/#comments
Thanks for replying Larry. The function init_fields in the script fails at the “ms-formbody”. I put the function into my .js file that is loaded by the master page of the SharePoint site. Other .js functions in this work fine so I think it is loading correctly. But when I call this line: if (typeof (fields) == ‘undefined’) fields = init_fields(); it fails in the init_fields() function.
function init_fields() {
var res = {};
$(“td.ms-formbody”).each(function() {
if ($(this).html().indexOf(‘FieldInternalName=”‘) < 0) return;
var start = $(this).html().indexOf('FieldInternalName="') + 19;
var stopp = $(this).html().indexOf('FieldType="') – 7;
var nm = $(this).html().substring(start, stopp);
res[nm] = this.parentNode;
});
return res;
}
Is this a custom list form (Customized form), or a OOB custom list ?
Is there am easy way to hide some items in the View menu. The problem I am have is every one feels they need a specific view, So i can create a webpart part the displays these in tabs. In the mean time I have a list of views a mile long, not very user friendly. Maybe even hide the view selector until I can figure a better way to navigate the important views
sorry, I found this post. give me some time to review
https://spjsblog.com/2009/11/27/hide-menu-items-in-list-view-toolbar-and-views-in-view-selector/
How can I hide “Download a copy” option?
Alex
Is this possible?
I have not had the time to look at this one yet.
Alexander
How can I prevent a dropdown box with more than 20 items from becoming a “filtered” drop down box? Right now my users have to double click a selection for my code to fire (which unhides/hides fields based on the selection)
A lot of users are not double clicking, thus fields are not getting filled out because they are not viewable.
I guess you are talking about a lookup column?
Take a look at this script Convert Singleline textfield to filtered lookup dropdown
This script can be used to convert a single line text field to a dropdown, pulling information from another list.
Alexander
Is it possibly to dynamically make a field required? If I’ve got a field hidden and I unhide it based on a selection, is it possible to at that point then make it required so they have to fill it out and prevent them from saving until it has some type of value?
Yes,
I have mentioned this in some comments, but not written an articles about it. You find some scrips for handling this in this collection from Erucy.
Se fieldutility.js
Alexander
Using WSS 3.0
Not have been able to find it anywhere so, since it is possible to filter a list items (in all event/task/etc view) based on membership in SharePoint group (By Alexander). I would like to request the possibility to filter an Agenda View on a single line text, based on a field of the current user information field (for instance department). I import data into SharePoint list what contains names of people. So users do not create the list items and there are multiple columns with names like Judge1 Judge2 Lawyer etc. As you all know you can’t use [ME] value in a single line text. This can only be used with columns: Created by, Modified by, Assigned to and People picking data. Problem with agenda view is also that it only displays 1 field (in general description of appointment for instance).
What do I want?
Filter (a) specific column(s) on the basis of the current user that is logged on (department field for example) in an agenda view.
The agenda should only show items that match the same text as entered in the department field of the user information field of the user that is currently logged on.
In my case IF Judge1 = Mr. J. Jenkins display it OR IF Judge2 = Mr. J. Jenkins display it. The OR statement is very important since SharePoint also filters with AND statement. So I would like to filter multiple columns with department field (any other also ok, as long I can fill in a value that is connected to the current user).
I already managed to create something that filters all event/tasks/etc list view, searching all the columns based upon the current user department field with or statement idea, but not specific columns. Also in agenda view my code and Alexanders code will not work.
If it is not possible to do this on each specific column it is also ok to search all of the columns since the names in my list are unique for each column. Other columns do not contain their names in such a way anyway. I’m already using my script for the not agenda view and works perfectly except user with slow internet will see the entire list my filter starts working.
Excuse me for long text, but it is complex. Much appreciated any help, suggestion or solution.
Any idea in what direction the solution will be like? In caml? or java? et
Hi,
It will be both CAML and javascript. I have thought of querying the list with CAML to get an array of the ID’s to display. Then loop trough all “items” in the current view, and remove all not in the array.
I’m afraid you will have to wait a bit before i come up with a solution, there are quite a backlog on articles to write.
Alexander
Thanks for the quick response again. Just asked so perhaps I can look in a certain direction en try some stuff. It is what I aspected the direction.
If I figure something out I will let you know ofcourse,
Thanks again.
Just to keep you posted I tried all weekend including today lots of things, but to no prevail. I do know a calendar view for list view won’t accept connections however this was not possible to do anyway in wss 3.0. It is also very clear I cant just adjust aspx page to my liking with javascript or caml query sadly enough.
From now on I will be patiently waiting, it gets to technical if I go any deeper I’m afraid. Finding and especially filtering the calendar items seems the hardest.
This thing is a headache, hope I don’t transfer my headache to you.
Hi Alexander,
Tried filtering with SP designer with no luck. Can’t seem to accept it seems impossible. Perhaps you made any progress on the calendar filter?
Thx again.
Sorry, but i haven’t had time to look at it yet.
Alexander
Hi Alexander:
I am looking for a way to insert code into a CEWP so that my current filter choice in my List View appears as text.
Example:
This report was prepared for: Alexander Bautz
(where “Alexander Bautz” is filter I selected on the [Customer] field.
Thanks-
Hi,
Didn’t this article give you a solution to this issue?
Show active list filter above list view
Alexander
… I think the stress of moving my elderly parents has taken its toll on my memory. Sorry Alexander.
Is there a way though to have the filter tag so I can place it into a CEWP and manipulate it?
Thanks-
Hi Alex
I have two list that are connected through a web connection and I would like to hide a column on one of the lists. As you can see it is a regular aspx form not disp/edit/new.
Can it be done?
Tony
Hi,
Yes it can, i have made a note of this request, but cannot promise anything as i have quite a backlog on requests. You find some to work on in this post vLookup type rollup for SharePoint Look at the hiding of the ID column in the code (a snippet here):
Alexander
Is there a way to dynamically change the description of a field? currently I am using ur script to change title of a field basedon content type. Would like to used the same functionality, just can’t figure to line of code to hide and replace existing description.
It’s kind of difficult to get the description from a field, as it is not wrapped in its “own” tag. If you have plans on changing it dynamically, i would recommend you to handle it all in the script. use something like this:
Alexander
I have another request hoping you can help me finish. It is along the 5 star rating request for items in sharepoint. Currently I have a calculated field, using Christophe’s text2HTML script, like this:
Here are my styles
with this image
http://home.comcast.net/~larry.h.pfaff/stars.gif
I have an alert in the onclick event and this all works. What i cant get or not sure how to do it how to track and average clicks. this set up uses classes to change the stars. It defaults to the class nostar, but I saw you had some code that added or changed a class.
I was thinking that I could create to other columns, number, one could sum the stars clicked and the other number of clicks making it easy to do the math for each item.
I remember you have the other script to update fields in the list view so I know this can be done just beyond my skill set.
I know your busy and I will continue to hack away at this. any help or advice would be appreciated.
thanks again
Update, I have a way, using another calculated field to update the class for the stars.
[sourcecodelanguage=”javascript”]
=”…
StarClass formula
[sourcecodelanguage=”javascript”]
=IF(NOT(ISERROR([stars]/[votes])),IF(ROUND([stars]/[votes],0)=5,”fivestar”,IF(ROUND([stars]/[votes],0)=4,”fourstar”,IF(ROUND([stars]/[votes],0)=3,”threestar”,IF(ROUND([stars]/[votes],0)=2,”twostar”,IF(ROUND([stars]/[votes],0)=1,”onestar”))))),”nostar”)
So now I am trying to fiugure out how to sum stars (in one column) and count votes(in another column) while at least limiting them to one vote per browser session
Larry,
Sorry, but i cannot help you with this as it is a bit complex to look into. I have plans on updating the solution with the 5 star rating system, but there are so little time…
There are probably not much help in me saying this, but i would have handled all this within the original rating script, possibly using “-2”, “-1”, “0”, “1”, “2” as rating and then averaged it to display the correct star combination. The number of votes could be a mouseover or a text behind the stars.
Alexander
that makes sense. the first time I wnet thru ur rating script I was trying a differnt angle and i was not having success. At least I have a new approach.
thanks again
Alex
We have 2 date fields i.e. Start Date and End Date. I want to validate End Date field using onblur event. Validation should check the End Date should not less than Start Date.
Please let me know how can I do this, as I newbie in programming, working on this from last 2 days, still not able to resolve it.
Ple…………..ase help me out
Hi,
Drop this code in a CEWP below the NewForm. Change the fieldInternalNames to match your date fields. The code executes on click on the OK button and aborts save if it triggers.
Alexander
Will presave function work on customized newform.aspx?. I have added my own code for submitting record on onClick event
Hi,
I’m not sure. You would have to test it.
Please let me know how it goes.
Alexander
with the date function here is there a way to build into this a way to default the enddate. What i mean by default is when I click the date picker icon the calendar date in the popup defaults to what was selected in the startdate?
If pick a startdate for end of year, I have to navigate thru the enddate the same way. Making it default to the startdate that was selected would just simplify it.
Hi Larry,
I’m not sure how to “hack” the default date picker to default to this date, but it’s easy to insert the “start date” in the “end date” field, and when the user clicks the datepicker icon, the date will be “defaulted” to the “start date”.
Like this:
Alexander
Thanx A, this was the direction I was leaning. So how can this be modified to change the end date when start date is change? is this fired off with a click function?
i just found out with an alert that the date value doesnt change until the save. Setting date 2 = to date 1 wont work. there has to be another way to set the val of date 2 with the changed val of date 1 before the save. is there a way to use the existing function and write to both fields?
I hate to bother you with this but I cannot figure it out. I have number fields. They hold IDs. I dont want any numeric punctuation added. No commas, no decimals etc.. I know how to create a calculated formula to remove all this, but I am hoping to avoid this route. I really only need this applied in the list view, but every string replace technique I have applied failed. The following is my last attempt. Can you advise what I am missing?
Hi,
You had the syntax a bit wrong:
Alexander
I hate it when I see i was that close. Thanks a million for all your help.
Hi Alex,
This is really great blog!! awesome work and i am big fan of this site, i check everyday and look at the things and learn , but i need something that i cannot find any where. Let me explain what i need..
I have a list with a people picker and a field called email address, i want to get the email address populated automatically depending the person on people picker ( single user). I know that i need to get user information from profile, but i am not a programmer and there i need your help.
I know you are really busy but please spotlight when you have time.
Thanks in Advance.
A helped me with this script that pulls data from people picker fields and auto populates people picker fields, this could easily be set to email. I hate to repost it, but I can’t remember where it was posted.
You need scripts from this site, jquery and a few others.
AccessUserProfileInWSS should have instruction where to get them all.
source list – where data is stored = var arrOfFieldInternalNamesInManagerList = [‘Manager’,’Manager2′];
target list – list to populate = var arrOfFieldInternalNamesInThisList = [‘Manager’,’Manager2′];
this script hides the user and manager fields, and auro populates them. you can unhide the fields and populate different data.
Hi,
I’m glad you like my blog. I have made this solution for you: Pull e-mail from people picker and write to a separate textfield
Please add further comments to the article linked to above.
Alexander
Your stuff is awesome, I have an issue and are curious as to what you would recommend for this.
Scenario: organize list items in folders where name is field value entered into newform.aspx
Requirements: create list items in correct folder without user intervention,
Considered using SP presave action to create folder based on list field, not sure how to add item to that folder.
Folder path is populated in query string with ?RootFolder=/Lists/List/[Folder], List field is single line text
Any help is appreciated
Thanks, Joe
Why do you need folders? There are many arguments out there on the pros and cons of folders. Personally I feel the Meta data can handle 90% of this concern and is very easy to implement.
One problem you may have with the creation of folders by end users is the lack of consistency you will have from user to user. This could become a maintenance nightmare after you have 100’s of folders created in a library. If you restrict the naming convention they you may run into the duplicate folder names.
There are also topics that folders interfere with custom views. I am not 100% convinced of this, but it does present problems. Go with the Meta data it is much easier to regulate and standardize.
Hi Joe,
I support Larry’s comment above. Though it may be possible, it will rather quick get “dirty”. If you need any more, please post further comments on this thread.
Alexander
I have an observation form with 6 radiobutton fields. the options for all 6 fields are the same:
– complete – Not complete – Partial complete – N/A
on the newform or edit as the user makes selections I want to tabulate selections in 4 additional fields (Number). One named for each of the options.
– complete – Not complete – Partial complete – N/A
I can set a field value with pieces of your scripts. I am not sure how to trigger the count when an option is selected.
this is only half. How can I count the Complete field each time complete option is selected from any of the questions. And how can I decrease the count when Complete is deselected.
Not just compelte, all options for all fields.
Hi Alexander:
(related to your vLookup solution) –
I need to be able to import/paste a list of employees where one of the fields is the employee number. I can’t import it as a number because I need the leading zero’s (mine is 007064).
I would prefer importing this number into a Person or Group field, “automatically” prompting the List to authenicate it against my users.
Once this employee number triggers the authentication, I can filter by [me].
Any ideas how to import a number and then trigger an “automatic” Person or Group authentication?
As always, Thanks-
Charlie Epes
Buffalo, NY
you can handle this a couple of ways. First is the the number field can be a single line text. this would allow import of leading zeros. If you can go with a single line field and you need a number. add a calcualted field to read the number and set the fiels to the length you need which will add leading zeros like this:
Hi Charlie,
My first thought is to use excel (and vLookup) to find the loginName for the users (matched from another source/sheet) and to paste the loginNeme in a SharePoint datasheet view (just set the people picker to expect loginname in the list settings).
This will be far easier then using javascript to match the employe number with loginName.
Alexander
Thanks – both of you-
I forgot I can set the people picker to expect loginname… duh.
I’ll try it.
Thanks-
New request I believe it is fairly simple. By the way congrats on your article making it to EUSP.
Again I hacked another piece of your code to color the background of the heading of a grouped view.
running the code like this tasks the resources so i modified it like this
this applies color to the first and second level grouped items. I would like to apply a differnt color for the second level, but I am not sure how. I have not been able to find a way to distinguish the two levels apart. any suggestions?
Thank you,
I’m not sure if this is what you try to achieve, but try this:
Replace the “dummuyClass with the class you want to use.
Alexander
You are my hero!
Hello.
I have a list with about 25 columns which is too wide to fit horizontally on most monitors.
Is there a way to dynamically collapse and expand columns in a SharePoint list (using jQuery) so the user can choose what columns to view?
Hi,
I have thought of making a solution like this. It is in the “queue”, but i cannot promise a delivery date.
Alexander
Alex great work as normal, I have a page with multiple lists that are filtered I would love to be able to hide the list if the filter returns no records, is it pauseable?
Tony
I have another request. I have been hacking away at a piece of your code from the rating script. I want to hide a column, multiple columns. In that script you hide the ID column. I also saw another post similar to this. I even tried that code but no luck. this only hide the header cell
what do I not see? what am I missing to hide the column StatusFlag
just saw the previous post. I dont need dynamic right now. would be happy to just hard code it.
The code is for the table header only. You must iterate over all the tr’s in the table and hide the td where ‘cellIndex’ equals IDcolIndex.
You find the code in the posts you refer to, just search for “cellIndex” in the code.
Alexander
thanks I will look into it
I went through the code some more and was able to find what I think you were talking about. I made a few modifications and put this together . Now I’m getting an error on the page
‘g_ExpGroupState’ is undefined
I know I am close because the header is hidden, but I have lost all data in my grouped view. Headers are there, just nothing below them.
can you see anything obvious I may be missing?
I finally got it. I was missing one more lines of code. Now moving on to adding checkboxes to hide and show.
So I have it working now and I added a checkbox to work on the hide show. It seems the the function only fires once on the click function for a checkbox. Do you know how to trigger the event for each click of the checkbox?
How does the code for the checkbox look? – my first thought is that you must use “click” and not “change”, and check the myCheckbox.attr(‘checked’) for true/false.
Alexander
thanks, I have been back and forth with change and click, not getting either to work like I want. Here is my function and checkbox
this seems to fire only once. I also tried by checking the attr but then it only fires once as well
can you see what I am not?
Here is a working code example (my column is named “HideMe”:
Alexander
BINGO! thanks a milllion. I would have never got it. I owe you.
I have a request
I have 5 content types for a list Eg: Content Type A, Content Type B, Content Type C, Content Type D, Content Type E
and I have 4 or more Security groups, say as Group P, Group Q, Group R, Group S
Now my scnario is Group P should see Content Type A,
Group Q should see Content Type A,Content Type B,
Group R should see Content Type D,Content Type E,Content Type C
Group S should see ALL Content Types data
Is there is a possibility,.. ?
Yes, ther are two main script that come to mind from this forum that you could use to achieve this result.
Identify content type to execute content type specific code
https://spjsblog.com/2009/11/20/identify-content-type-to-execute-content-type-specific-code/
and
Showing or hiding list fields based on membership in a SharePoint group
https://spjsblog.com/2009/09/20/showing-or-hiding-list-fields-based-on-membership-in-a-sharepoint-group/
these two scripts in combin ation can achieve what you need
Alex great work as normal, I have a page with multiple lists that are filtered I would love to be able to hide the list if the filter returns no records, is it pauseable?
Hi,
Try this in a CEWP below the webparts to hide:
Alexander
you made a post to change external links. I an trying to modify this to change an attribute. the problem is I dont have access to the parent frame because it is hosted by a vendor. ther is an email link in the parent for help. it is a mailto link. I was hoping there is a way to change this through script. this is what I have so far
Through a UI I can change the email address, but I do not have access to the link attributes.
Is there a way to access the parent frame of an iframe and remove the “mailto:”?
I’m not sure, but if you wrap he code like this:
Does it help?
Alexander
I have a simple request. I would like my attach file button open up an excel spreadsheet. once they fill it out, then it saves the way a normal attachment does.
In a nutshell I need the attach file button to work similar to how the new item work from a doc library that has a pre-defined word doc template.
Hi,
I’m afraid this is not a simple request… The “add attachment” is based on upload from the users hard drive. A spreadsheet would have to be saved locally by the user and then uploaded.
I have no immediate solution to this request.
Alexander
thanks for all your help
Hello
I have dropdown field in newform/editfor. This drop containing US States and “Select State” as first option. It is required field. I want that If user doesnt select any state, leave “Select State” as default value, my required validator message should display.
is this possible
Elstone
Hi,
Add this code below NewForm and EditForm:
Alexander
Hi Alexander
We have a form on which we have three person fields. What we would like to do is make fields on the form read only based on which person field they are included in. Is this possible?
Thanks
Andrew
How are you setting up the people pickers? I am trying to understand how you know a person is in a pp field and not all. Will the field be populated with a value? If so I could see easily grabing the value.
Playing with some simple jquery and hacking some of A’s code here is the code to hide a people picker. if you add it to a function that checks field values and compares against user. the following posts could help you identify the user for comparison.
Autocomplete for SharePoint people picker
Link to fill user login name in people picker
Sorry I don’t think I explained myself very well. What we have is three people picker fields employee, manager, director that would be filled out on the newform. Once somebody goes in to edit the form we would like each person to be able to edit certain fields.
So for example the director would only be able to edit a specific number of fields and the rest be read only. The same would apply to the manager and employee.
Does this make sense?
Thanks
Andrew
So then A has this script Showing or hiding list fields based on membership in a SharePoint group. this script hide/show fields based on user in a group. Although not exactly what your looking for it is a start.
Thanks Larry we use this feature elsewhere but in this instance on the edit form we require users who are filling in the form to be able to see the fields that have been entered by other users. This means we require to make the fields read-only and not hide them.
I apoligize, instead of hiding the field set the attribute to readonly. I know there isnt a script readily available here. At times I have found myself taking pieces of code from many of A’s posts and putting them together for my solution.
Again I apoligize, I know there isnt your exact request visible, but there are close representations that you can piece together or modify if you have some development background. I would be willing to help you if you want to try.
Using the logic from this newly added post: Get field value for all SharePoint FieldTypes or set field as read only in EditForm
Here is an example:
Alexander
Hi Alexander
This is exactly what we were after and works great!
Many Thanks
Andrew
Hi Alexander
We are trying to use this script alongside the fields side-by-side script but I cannot get them to work together. Any ideas or suggestions.
Thanks
Andrew
is there a way to create an assessment type functionality? Your HTML tooltip displays text on hover from another list. is there a way to create an intake that can compare data from another list (questions, questionID, answerA,answerB,answerC.., correct answer) and on submission have it return user selections in addition to a right/wrong answer, pass/fail status column(s)?
Hi,
Thank you for helping out answering questions.
About the request: It is possible, but i think this would be a bit to specialized and a bit to much work to post here. If you set up a more detailed description and email it to me, i might take another look at it.
Alexander
In a document or form library there is a function you can access in the settings called “Relink documents to this library”. I have a large need for this when dealing with InfoPath forms and republishing. This page allows you to see the documents in the library and the template path. Each item has the option to be selected, then relinked. By default you have to select one at a time or click each checkbox.
I built a “select all” webpart and added it to the page and it works perfectly. The view is set to 100 items at a time with paging. There is no way using the UI to change this. However; I can change the page source and manually change this number.
I do not like making the change this way because it removes the page from SharePoint and make it like any webpage by unghosting it.
What I want to do is add a simple script that will replace the rowlimit of 100 with another number but I can not seem to access it. In the Forms/repair.aspx source this is the part of the code i need to change
[sourcecode]
<RowLimit Paged="TRUE">100</RowLimit>
can it be done using jquery?
I do not think it is possible that way, as the view is specified in the list schema and any modification after the page has loaded has no effect.
However you can modify the view from within SharePoint with a small “hack”:
Get the view GUID from the relink view (view source and search for “ctx.view”), copy with the braces like this {439B16F7-B588-4E87-9558-7B33E9E5FADF}.
Then go to another view in that list, click “modify this view”, then replace the view GUID in the URL at “&View=” and reload the page.
Alexander
I can live with that. That was easy. thanx a million.
one more question on the relink page. I have a decent select all function. I have been able to add it to the tool bar and just below the relink label for that column. What I want to do is hide the column title “Relink” and replace it with my string “str” for select all. Either I hide the entire cell or I get an error. this will append the “Relink” text
[sourcecode]
$("th.ms-vh2-nograd").append("<div style=’font-size:7pt’>"+str+"</div>");
what will replace? I cant figure out the syntax.
Hi,
Not sure if this is what you want, but replace “append” with “html” to use your div as the header title.
Alexander
I have almost completed this task on the relink page. I can write a checkbox in the relink column header, but I can’t get it to format clean. I tried to do a string replace with jquery but not successful. I finally got a solution to work.
can you take a quick look and let me know if there is a better way?
all I want to do is hide the text “Relink” and replace it with my “str”
Alexander
Thanks for previous info. New general knowledge request. I have an intake using several of your scripts. The newform and editform scripts are almost identical (hide content type field only difference). The new form works perfectly. When I edit an item some of the scripts appear not to work. When I set the page into edit mode, they begin working. What can cause this to occur?
I figured it out. What I have been doing for simplifying maintenance I add all my external scource file links into a text file, link the CEWP to the text file.
I do the same thing for my functions, I have one for the NewForm and another for the EditForm, both share the source file links. Much easier to edit in a text file than a CEWP. What I found was the source file links were not loading in the page until I put page in edit mode. I don’t know why. I deleted that CEWP added a new one and recreated the link to the file. works fine.
thanks again
Hello
I want to implement following process in “Delete Item” from ECB Menu and from fispform.aspx form tool.
1. Can I set redirection whenever user click on “Delete Item” from ECB menu or Form Tool bar
2. Is this possible if we can add one more button/option in Form Tool Bar of “dispform.aspx” thne clicking on this new page redirect with page source as query string to another page.
Please help me
Hi,
For modifying the delete function i would recommend an event handler and not javascript. Even though you can override the default functionality when deleting, this must be added to every view of the list.
To add a new menu option use this code in a CEWP below the form:
Alexander
Hi Alexander
Is it possible to use the readonly field script I requested above with your fields side-by-side solution? I don’t seem to be able to get them to work together.
Any help would be appreciated.
Thanks
Andrew
Everything is possible, but i have not had the time to look at it. I think it will require modification, but is possible.
Try to change the order of calling the scripts as it may be important.
Make a go at modifying it and let me know how it goes.
Alexander
Hi Alexander
I have played around with re-ordering the scripts but have had no joy getting them to work together. It just repeats what is contained it the first field and repeats it across when they are made read-only.
Thanks
Andrew
Hi Alexander,
after having implemented a number of your great scripts, two new thoughts crossed my mind. Well, they are not exactly my ideas but have been inspired by your scripts.
To start with an easy one (maybe), we are using document libraries with grouped views to display data to the customer. With the help of some other script I managed to get rid of the “Group by part left of the ‘:'” (I’ll gladly provide the script if you are interested), which gives a much cleaner look. Now I would like to limit the number of displayed items per group to “x”, or maybe even depending on the group to “x or y”, but SP only allows to set a limit for all items on a page.
It’s a bit like “display only the last x|y items” for group “x” or “y”.
The second one is related to list views, I got this idea when I saw your article about column visibility. As of today, we are using an excel report to show report data for the last four calendar weeks. The data and the “column” shift have to be done manually. With the column visibility article in mind I thought if it would be possible to have SP automatically ‘shift’ visible columns, thus showing the ‘current’ and ‘current-x’ calendar weeks?
If you need further details on this let me know.
regards,
Chris
Hi Alexander,
any chance you can have a look at this?
regards,
Chris
Hi,
Unfortunately my kitchen renovation has eaten away from my “blog time”. I cannot come up with a solution right now, but if you look at my other scripts that “interact” with a grouped view, you can start off by yourselves.
The trick would be to limit the number of “tbody” elements rendered (hiding or removing the excess).
Your other question is related to this comment You might create something based on this solution.
Alexander
Almost forgot, I’ve got a link tipp for you. Maybe you can grab something useful there.
http://www.tripwiremagazine.com/2010/04/24-irresistible-jquery-tips-to-power-up-your-javascript-skills.html
Chris
Good Day A,
Some time back you helped me with the syntax to hide commas in a list view. works perfectly. I would like to take it one step further. for the headers, where we can sort and filter, the comma still displays here.
Can comms (or special characters) be hidden or removed from the filter menu of a column header?
Hi All,
This is Krishna and i am new to this blog.. And coming to point, my requirement is: When we want to view a particular item in a task list, just we will click on item and the record is shown in DispForm.aspx. If we want to view any other record again we should go to task list and click on the required item record.
My requirement: I need to create a “Next” link button on DispForm so that when user the user can view the next record without goin to tasklist again and clicking on next record.
Any help/solution/suggestions will be grateful.
here is a proof of concept. I borrowed this script from Christophe at blog.pathtosharepoint.com and made some modifications. the result has a prev and next functionality. with some work you can make it fit your needs.
the original function displayed the item ID either at the top of the form or the bottom, but not both. The bottom is commented out, but you can swap them around.
let me know if you have any questions
two more notes.
1. I miss a set of “=” signs on line 21
should be this
2. if the next or previous ID does not exist you will get an error. you may need to create a check that determines if the next ID exists. If not go to the next.
Thanks larry..Thats realy good. But i need some modifications on that. i.e when we open first item and click prev button it is showing some junk values. If we are at first record and the user clicks on Prev button we should show a msg that its first record.
One more important thing is i need the basic idea of this how u created and can u give description on this bcoz i knew javascript but i never used the methods and attributes u have used…Please help me on this k..
Thanks
K.K
Hi this praba,
Please advice / help me to build the below scenario.
Scenario 1
Batch update using Data view Web part and select all checkbox.
1.In a data view web part
2.Select records to be edited using checkbox
3.Edit multiple records fields
4.Click the update link to update all the records to sharepoint list.
Scenario 2
1.I have a custom form build using asp.net
2.Populate same form with SharePoint list data’s
3.And update from same form to SharePoint list.
Please help me build the above scenarios,
Millions of thanks in advance.
Praba.
Hi,
I’m afraid this is a bit to specialized for me to do as a “general” blog article.
The first scenario however could be derived from my article Edit date, single line text, number or boolean columns directly in list view, but making both the first and the second request come trough would require a specialized solution that i regrettable cannot give you.
Alexander
Hi Alex:
Please give some tips and advice to achieve the above Scenario 1 and 2, because I am very new this areas.
Thanks
Prabakaran
Hi again,
Sorry, but as i wrote above, this one is to complicated to create as a blog post.
It’s possible, no doubt, but may take hours upon hours to create. Unless you can learn from this (and other) blogs and begin writing the scripts yourselves (and ask if you have specific issues), i cannot help you with this one.
Alexander
Hey A. Hope you’re well. I was trying to add a script to set the width of a text field. I can make it smaller with no problems. Trying to make it wider than 300px 400px can’t do on a new or edit form
Any suggestions?
Hi,
try this using the function init_fields():
Alexander
Hello
I want to hide toolbar completely when user is belong to “Requester” sharepoint group. How can I do this?
Is this possible?
Hi,
You remove the toolbar like this (supports multiple webparts in one page.
To hook it up to a user group, look at this article: Showing or hiding list fields based on membership in a SharePoint group
Alexander
Hi Alexander…. great job with your blog. Has been very useful so far.
I wanted to ask if you have any solution for dynamic fields into another form.
The idea is for example, fill a new form with a course information, and have fields with name and e-mail address. Then i can complete this two fields, and if i want i can press an “Add” button, so dynamically appears another 2 fields with name and e-mail, and so on.
This 2 fields, should be saved on a diferent list, and be linked by his ID with the course information.
Would it be possible?
Regards,
Nicolas
I want to Hide “Site Actions”,”View All Site Contents” and “Sign in as Different User” for all the users who does not belong to “Administrator” group, How can I do this?
Hi,
I do not think javascript is the way to do this. The code would have to go on every page in the site.
A feature or custom master page could be used (security trimming the controls). I’m not the guy to talk about regarding this approach, but here is how you could do it with javascript (place the code in the master page to load it in every page, or use SharePoint Infuser
Use this post Showing or hiding list fields based on membership in a SharePoint group to learn how to get the list collection from a user. You will have to pull parts of the code and combine it with something like this:
Alexander
Hi Mr.Alexander,
As per your instruction, i’m posting the request here. I have a long pending urgent requirement as below.
I have a simple list with below mentioned columns(fields).
1. Title 2. Part No. 3. Part Name 4. Model 5.Make 6.Comments
While creating these columns, i have given some detailed information about these columns in the “description” field of the respective columns.
As we all know, this description can be seen by users who have only “Edit Permissions” for the list.
Requirement is, just to display this description as a tooltip when a “read-only” user of that list hovers the mouse on the column(field) in “DispForm.aspx”
I have seen lot of solutions which are showing tooltip at items level for the list. But, here i want to show tooltip at “column(field)” level.
Could you please check and help me on this?
Awaiting for your reply with anticipation.
Thanks in advance.
Hi,
Pulling the description from the list schema is possible, but is it something like this Add HTML mouseover tooltip you are looking for?
Let me know if you rather would use the native description for the field and i could write a solution.
Alexander
Hi Mr.Alexander,
Thank you very much for your prompt support.
In my earlier request, i have mentioned wrongly as “DispForm.asp” by mistake.
Actually, we need to show the tooltip in “AllItems.aspx” page of a list.
When the user sees the SPGridView and hovers the mouse on the grid column header, we need to show “description” property information as tooltip of that particular column which was given at the time of the column creation.
Information in the blog “Add HTML mouseover tooltip” is to show the tooltip at edit mode/Editform whereas we have to show column description as tooltip at “AllItems.aspx” page.
Eagerly awaiting for your reply with anticipation.
Thanks in advance.
Hi Mr.Alexander,
Could you please check for the “tooltip” requirement given as a reply to your response ?
Awaiting for your valuable support
Thanks in advance.
This example does NOT pull the description from the field itself, but enables you to add the text directly in the script. This is a bit easier to implement. Look at the code and edit the variable “myTooltipObj” to match your columns and descriptions.
Does this answer your request?
Alexander
Hi Mr.Alexander,
Thank you very much for your reply.
I have added your javascript script and implemented in my list.
On click of my “list” link on QuickLaunch, list is displayed but the tooltip is NOT displayed on mouse hover to “title” column.
I added a alert statement and checked. This alert is fired on only “page refresh” and not on Mouse Hover.
Should i have to add anything else to fire mouse hover ?
Could you please help on this?
Thanks in advance.
Hi Mr.Alexander,
Thank you very much for your reply.
I have added your javascript script and implemented in my list.
On click of my “list” link on QuickLaunch, list is displayed but the tooltip is NOT displayed on mouse hover to “title” column.
I added a alert statement and checked. This alert is fired on only “page refresh” and not on Mouse Hover.
Should i have to add additional code anything to fire mouse hover ?
Could you please help on this as i am very much new to jQuery?
Thanks in advance.
Hi,
Sorry for the delayed response. Add the code i provided above to a CEWP and place it below the list view.
If this does not help, please email me some screenshots and i will try to help. You find me e-mail here
Alexander
Hi Mr.Alexander,
Yes, we have also done the same. But it was not showing the tooltip on hover the mouse on title column.
After seeing your reply, again i went to my list and checked. When i have hovered the mouse with little bit space away for the column text “title” ( but within that column area), the custom tooltip is displayed.
Hope this will work for any custom columns !
Excellent work !!! Thanks for your prompt support !!!
If i hover the mouse exactly on the word “title”, tooltip “Sort By Title” is being displayed.
Still the below things are disturbing our minds.
Could you please check and clarify below things for me?
1) Is it possible to remove this MicroSoft standard tooltip (for both pre-defined and custom columns) ?
2) How about “Pulling the description from the list schema” as you mentioned earlier, which was already given by us at the time of column creation.
As we want to show the information given in the “description” property of the column given in add/edit mode, is it possible to show that information instead of our static information using the above procedure ?
If the second approach is implemented, then we need not have to do anything extra work when a particular column’s description is changed.
If it is not possible, then we will go by the way you have suggested above.
Once again thank you very much for your support.
Thanks in advance.
Awaiting for your reply.
See this article: Show field description in list view column header
Alexander
Hi Mr.Alexander,
Thank you very much for your prompt support.
This is what i was expecting.
Excellent Work !!!
Thanks a lot for your valuable time spent on the same !!!
Thank You.
Saran
Hi Alex,
Do have any tips for using JQuery to Custom sort a lookup list? I’d like to do concatenate ID and Description in a lookup field.
Hi,
Is it a “Single item lookup”?
Alexander
Hi Team:
One of my column is to be unique.
How to fill this requirement using Jquery to enforce uniqueness in any Single line of text column.
Regards
Praba.
Hi,
This article answers your request SharePoint list’s or document library’s: Primary key in selected field
Alexander
Hi Alexander,
I have been using your solution for filter list by group membership. Recently we have a requirement to filter list by user profile, this has to be done because of some issues with “only their own” settings. would you be able to modify your function “filterListViewByGroupMembership” to filter view by userid/login id? tried to do it myself but i cant seem to filter it right. many thanks
Answered here
Alexander
On the edit or disp form, is there a way to hide or remove commas from a number field? I have been able to do it in a list view, but not the forms.
Hi,
Under list settings you can set the “Number of decimal places” to 0.
Is this not an option?
Alexander
That work for the decimal, but not commas. I have an intake that user an emp id. it is easy to copy the id rather that type it, but this 9 digit field adds to commas. Is there a way to do a replace on these forms?
The commas is the “thousand-separator” based on your regional settings. SharePoint will always add it to DispForm and to EditForm (as you said), but If the input is indeed text, why not convert the field type to text?
It is quite easy to replace the commas, but if you do not need a script it would be even better.
Alexander
I do understand. For some time I have struggled with this field. Initially it was setup as text, but there are no id’s that are alphanumeric, yet we still have people that do not understand with their emp id is. So I converted to number. The delima I have now is if I go back to text, I need a script that will only allow numeric values, if I stay number field I need to strip the commas, lol.
which, in your opinion is the best way to handle this knowing I will eventually have to add a script of some sort? which leaves the smallest footprint?
I think using a text field is easier – here is some code for you Numbers only in single line text field
Alexander
One more thing – if the “emp id” is found in the users profile, you can pre fill this value for them.
Alexander
you are the best. I think when we upgrade to MOSS there will be more emp info available, but for now we are stuck here. thanks for the quick turnaround.
I was recently asked if wikis support bookmarks. With the research I have done it is supposed to be true. The first page I created with bookmarks worked perfectly. When I added updates, the bookmarks went from relative to absolute links and now they open the edit page. Going back to a script you wrote to modify href attributes in a web part I am trying to figure out how to remove the URL up to the “#” in a wiki page.
turns into this
what is the easiest way to remove the URL up to the “#”? I can’t get it.
if removing the URL is not the way, can we do a replace with the current page URL, which is ultimately what would work best
Hi,
Try this:
Updated 24.06.2010
Alexander
Perfect!
along this similar line. Within the wiki, which I dont believe matters. I say not matters because I have had the same issue using a CEWP. I have created a unordered list for navigtion. it is layed out horizintally. I want its position fixed. CSS wont work. I is enclosed within a div like this,
[sourcecode]
<div id="menu">
<ul>
<li><a href="#a"><span>Alpha</span></a></li>
<li><a href="#b"><span>Beta</span></a></li>
</ul>
</div>
How can I get this to have a fixed position when content on the page scrolls?
Update: The bottom solution is IE only…
My initial suggestion (but look below for an easier method):
Never mind that script – it is not necessary to use a script… I still have a lot to learn about CSS:
Update: This solution is IE only…
This is the easiest method
I learned this from this article about frozen headers in a list view: Scrolling View with Frozen Header
Alexander
great job. Much further than I was able to get. The first solution worked the best except for the alignment. The top navigation (list)sometimes falls on the text when navigating.
the second script i have tried several different ways to implement. On the wiki page I added a CEWP with the style and list. it sits at the bottom of the wiki and does not scroll or move to the top. here is the code in the CEWP
then I moved the list nav to the wiki page
what I found was that the content needs to be wrapped in a div and I could only make it work placing it in a table reading from that same reference you mentioned.
How can I make this work, frozen div head, scrolling text, without having to add a table?
I know I am bothering the heck out of you with this. I almost have this complete. I just found this last issue and I dont like the way it is functioning. I have the top navigation which is an unordered list layout horizontally. My content is in a div with an OVERFLOW: auto; HEIGHT: 420px
this allows the content to scroll up to the navigation tabs (bookmark links). in the wiki if I click a tab the entire page scrolls to the top right to the bookmark, hiding the tab navigation. I found this only happens when the SP page is already longer then what can be viewed on screen.
1. how can I stop the entire page scrolling and only scroll the content of the div.
2. I have a script to add/remove class on the tabs but only on hover. how can I add the same class when I click, but also remove that class when I click on another tab. Only want one tab with the class at a time like the hover function here:
when I add a click function I lose the hover. any suggestions?
Hi,
This is a bit to hard to piece together… If you could send me some sketches of what it is you want to happen, along with the code, i might be able to help.
Alexander
Hi Alex,
I am trying to create an presave action to make sure the client is sure before they submit the form.
Hi,
This is previously posted as answer to the same question:
Add a CEWP below the list form in NewForm and EditForm. Insert this code:
SharePoint automatically executes any code in this function when pressing “OK”. It must return true for the save item to take place.
Alexander
Hi Alexander,
is it possible to redirect new- and editform.aspx of a list to e.g. a webpart page? I’d like to set up a webpart page with cewp’s in the middle and on the side. The side webparts will be used to display additional information, the middle webpart(s) will be used for the new/editform.aspx
Chris
The default NewForm, DisForm and EditForm are defined on the list in SharePoint Designer. I think you could create a custom NewForm in SPD and use it, but i do not have any detailed walktrough on that as i newer modify the form other than using client side javascript…
Alexander
is it easy to have a popup window say from another list in SP. that a user can open scan the list click an item in the list and have it write that item to a field of a newform or the same or another list. It cant refresh the page or previously entered data could be lost.
I have a location list broken out by country, 150 locations, 12 countries. I dont want to add addition additional fields (cascade). I though a popup win work a bit easier. when they get to this field they click to open the popup, find the location code, click the code and populate the field in the original newform.
How hard is this to accomplish?
Hi. I’ve been looking all over the internet for a clean way to simply query individual columns of data from a list.
I would like to take a column and put all of the data into an array and then use that array elsewhere in my code (in a CEWP). So many blogs and posts seem to tell me what to do but I don’t think know enough about JQuery to understand exactly where the extracting of data is taking place. More importantly what jQuery libraries or functions would I need to use to perform such a function. I’m not looking for written code per se, I just am looking for a plain English explanation of what i would need to do.
Thanks if you think you could help.
don’t worry about this post, i have other questions in one of your blog posts
Hi Alexander,
I want to to be able to hoever over the name of file (Infopath) in form library and popup an image which is a hyperlink to picture in picture library and is related to the infopath form.
Regards,
Osama
Answered here
Alexander
Hi Alexander,
Is there easy way to freeze the column panes in a view?
Look here for a solution:
Scrolling View with Frozen Header
Alexander
Using your init_fields_v2() to create a fields reference, how can I remove specific options from a SharePoint Select dropdown menu on one of my lists?
Hi,
This example removes the options Green and Yellow from the <select> with FieldInternalName “MySelect”.
Add this code to a CEWP below the NewForm and/or EditForm:
Modify the “src” to jQuery.
Alexander
Awesome! Thanks!
Hi Alex,
I’ve just got another question regarding this post
https://spjsblog.com/2009/11/05/requests/comment-page-7/#comment-3340
You’ve referred me to try
Unfortunately I’m not enough of a programmer to make this work with calendar weeks. From what I’ve made up so far (theoretically) I have to create 52 columns representing the weeks for a year. Then I have to create views that show 4 weeks, starting from cw01-04 and so on.
My problem starts with the calculation of the correct week for this ‘autochanger’ and continues to the part where my columns should show the reporting date instead of a calendar week, e.g. 01.01. 08.01. 15.01. and so on, increasing by 7 days.
I might be able to change that to a calendar week naming, however I’d still have a problem in the new/editforms since I don’t want to display 52 items all the time when only one is necessary (the current week item).
Can you nudge me into the right direction regarding a calendar week calculation for the sript above?
thanks,
Chris
Hi,
I’m a bit confused. I have read your original request and then this one. I must admit i do not quite understand what you want to achieve.
What kind of information is supposed to go into these 52 columns?
Please e-mail me some sketches or some more details and i might be able to help.
Alexander
Hello Alex,
I would like to ask you for some help, as i am trying to make a field update mechanism on the dispform.aspx. For example, when i open a sharepoint item and see the display form to have a button and when clicked to update the same item on a specific choice field only, in a way to manipulate it, from Status In Progress to be able to set it to Completed or something like that.
Regards,
Esad
Something like this Get or Set value for SharePoint field in NewForm, EditForm and DispForm (Get only in DispForm), just to be able from a buton on the DispForm to update a hidden/non-visible field.
Hey Alex, another question for you:
How would one, using your init_fields_v2() function, set a multiple lines of text control to be disabled and change the width of it?
I’ve been toying with it for some time now and decided to turn to the master for assistance. 🙂
Thanks!
Scratch that, I figured it out finally. 🙂
Hi Jason,
care to share the solution with us?
I have seen some fo the script where you can hide list view menu and hide individual items (views). Is there a way to dynamically change the label. I am creating some views like, Current Year, Last ayear, Current Month and Last Month.I would like to replace the text with the current date.
Current Year = “Year – 2010”, but next year it reads “Year – 2011”
same for month
Current Month = “July – 2010”, but next month reads “August – 2010”
can this be done?
Hi,
The people I’m working for have a request to basically “google” search a very large list (800+ objects). They want to be able to enter in a few keywords into a search box and have a filtered list returned. They don’t care which column the term falls in, it should all be found in the search.
I’ve currently implemented this idea using Javascript, but it has some limitations. First, it can only search the entire list if the entire list is visible to begin with. With 800+ items and IE6 requirement, this is bad. 2nd, it’s pretty darn slow on IE6 which is what I’m stuck with using.
My knowledge of JQuery is pretty limited so I’d be very thankful if there was a faster better solution than what I currently have.
[sourcecode language="Javascript"]
Search: <input id=tSearch class="ms-long" type="text" onkeyDown="return entsub(this.value, event)" />
<INPUT id=btnSearch onclick="return filterWords(document.getElementById(‘tSearch’).value);" value=Search type=button>
<INPUT id=btnClear onclick="return clearPage();" value="Clear Quick Search Results" type=button>
<INPUT id=btnClear onclick="return resetPage();" value="Clear All Search Results" type=button><br>
<b>Results: <div id=results></div>
<script type="text/javascript">
var lvRows = null;
/*** gets the list table from the page source code ***/
function getElementsByCssClass(sTagName, sClassName) {
var results = new Array();
var allTagElements = document.getElementsByTagName(sTagName);
for (i = 0; i < allTagElements.length; i++) {
var className=allTagElements[i].className;
if(className.match(sClassName)) results.push(allTagElements[i]);
}
return results;
}
/*** removes rows that do not contain the given search term ***/
function quickSearch(terms, lvRow, count) {
for(i = 0; i < terms.length; i++) {
if(lvRow.style.display != ‘none’){
if(getTxt(lvRow).toLowerCase().indexOf(terms[i].toLowerCase()) > -1) {
lvRow.style.display = "block";
}
else {
//if term is not found in row, row becomes not visible
lvRow.style.display = ‘none’;
count–;
}
}
}
return count;
}
/*** Makes all rows in the list visible ***/
function makeVisible(lvRows) {
for(i = 1; i < lvRows.length; i++) {
lvRows[i].style.display = "block";
}
document.getElementById("results").innerHTML = lvRows.length-1;
}
/*** gets the text from the fiven object ***/
function getTxt(obj) {
if(obj.innerText) return obj.innerText;
else return obj.textContent;
}
/*** Filters multiword entry with spaces as the delimiter ***/
function filterWords(input) {
var wordList = new Array();
var searchTerm = "*";
var count = 0;
var searchWord = "";
// Iterates over every character, adding new words to Array
while(count <= input.length-1){
// " " is ignored and all previous text is added to Array
if(input.charAt(count) == " "){
searchTerm += searchWord;
searchTerm += "*+*";
wordList.push(searchWord);
searchWord = "";
}
else{
searchWord += input.charAt(count);
}
count++;
}
searchTerm += searchWord;
wordList.push(searchWord);
//reset table to full for each new search
if(lvRows == null){
var lvTable = getElementsByCssClass("table","ms-listviewtable")[0];
lvRows = lvTable.childNodes[0].childNodes;
var add = 1;
}
makeVisible(lvRows);
var counter = lvRows.length-1;
// for each word in search, filter
for(var i = 1; i < lvRows.length; i++){
if(lvRows[i].style.display != ‘none’){
counter = quickSearch(wordList, lvRows[i], counter);
}
}
document.getElementById("results").innerHTML = counter;
}
/*** Ensures enter must be pressed before search commences ***/
function entsub(myfield,e) {
var keycode;
if (window.event)
keycode = window.event.keyCode;
else if (e)
keycode = e.which;
else
return true;
if (keycode == 13) {
filterWords(myfield);
return false;
}
else
return true;
}
/*** resets page filter search completely ***/
function clearPage() {
if(lvRows == null){
var lvTable = getElementsByCssClass("table","ms-listviewtable")[0];
lvRows = lvTable.childNodes[0].childNodes;
}
makeVisible(lvRows);
}
/*** Hard refreshes original page to remove all extra filtering that may have taken place ***/
function resetPage() {
var refreshURL = "";
var input = window.location.toString();
var count = 0;
while(count <= input.length-1){
// " " is ignored and all previous text is added to Array
if(input.charAt(count) == "?"){
window.location.href = refreshURL;
return true;
}
else{
refreshURL += input.charAt(count);
}
count++;
}
window.location.href = refreshURL;
}
</script>
<script>window.tt_HideSrcTags.done=true;</script>
Hi,
To use javascript/jQuery against a standard list view, all rows must be visible.
To overcome this you would have to make a custom query using a ajax webservice call, and parse the returned XML, reformatting it in a HTML table style.
This is absolutely manageable, but I do not have the time to help you with this at the moment.
Alexander
Hey, understandable. Thanks for the ideas though.
Krit,
Did you ever find a solution to this? Care to share?
Thanks!
Hi Alex:
On a SP List, is it possible with Jquery to transpose the rows and columns so that the column headers become the row headers, and the row items are listed across the column headers?
Thanks-
Charlie
Hi,
I’m not sure what you mean. Please give me a sketch of how you want the final product to look like.
Alexander
(had to put this into the corrrect Reply zone)
Hi Alex:
In the simplest terms,
________Item #1 Item #2 Item #3 Item #4
Field 1
Field 2
Field 3
Field 4
Thanks-
Hey A,
Do you have a post in here related to make a field required based on a selection from another field? I cant recall if you worked this
I have another new request. this one more important than the previous, making field required based on user selection.
I have been trying to create a copy text script, that allows me to copy data from a column.
I have a title field (singleline), CSS (multipleline), CC.
the title just contains the tile of the item and is unique.
CSS contains actual css like this:
[sourcecode]
.ms-globalbreadcrumb {
font-size:8pt;
text-align:right;
background-color:#ebf3ff;
padding:2px 10px 2px 5px;
}
I want to click something (button, link, maybe even the text) and it copy the text to the clipboard.
because the title is unique I can create an ID using this field in my CC like this:
then I added one last CC to add my button:
With ‘ClipBoard as my copy function
I use Christophe’s Script HTMLcc to transpose the HTML.
No matter how I try this I can not get the function to work.
Is there a way to add a function to copy text (Code or CSS) from another column or field in a list view?
I had entered my button text wromg, this is what I actually have and it doesn’t work
Hi,
I have not looked into this, but it should be possible – you would have to look elsewhere for a solution I’m afraid.
Try here: http://www.krikkit.net/howtos/13-howtos/16-copy-text-to-clipboard-with-javascript.html
Alexander
Hello Alex,
Thank you for a wonderful site – I have enjoyed using a number of your solutions. I have what I think is a very simple question that I have yet to find a solution for, and am wondering if you could offer a suggestion. Is there a good method to change the ms-formlabel related to “Content Type” on editform.aspx? I am using Content Types to control the status of tasks as they move through a process and would like to make it more clear for my users. Any help you can ofer is greatly appreciated!
Thanks, Isaac
Take a look at this article: Identify content type to execute content type specific code
Come back if this is not enough.
Alexander
Thanks Alex, sorry for this late reply. I finally had a chance to look at the post you referenced, and can see where you are identifying the content type drop down in your function for hiding the field. I’ve taken a crack at it, but am not getting the result i am looking for – I imagine my syntax is probably very incorrect. Could you take a look at my mangled code?
I have also tried this variation based on another method for changing a field label I saw elsewhere:
Each variation I have tried has either resulted in no change or an error message (“unexepected error occurred”). Thanks for your help, any advice is appreciated!
Hi,
Like this for EditForm:
And this for DispForm:
Alexander
That is fantastic, I can’t thank you enough! From looking at your code I can also see where I was going wrong. Your site is, as ever, a wonderful resource!
Thanks again,
Isaac
Hi Alex:
Is it possible to grab the group totals from the .ms-alternating line up to the .ms-gb line? And to move up the same info for a sub-group.
The purpose is so the data can be viewed in collapsed mode and still be able to see the totals for each group or sub-group.
Thanks-
Charlie Epes
Hi,
I’m not sure if this would work if the groups are initially collapsed. The data is not rendered before the group is expanded, and therefore i do not think this will be possible.
Alexander
OK. Is it totally different from your Success ratio solution?
https://spjsblog.com/2010/01/18/add-a-success-ratio-label-to-the-first-group-header-in-a-dual-grouped-list-view/
Hi,
I did a quick test and found that id does render (hidden, but renders). I’m not quite sure how you want this to look like so please give me a sketch of how you would have the setup and i can take a look at it.
Alexander
Try this one – Note: The groups must be expanded by default
Alexander
Alex: This is perfect! Thank you again.
I hope your summer is going well and somewhat restful.
Charlie
i am trying to search the items in a custom list in sharepoint201 using below
code
but it doesn`t work?
can you please help in achieving it
Thanks in Advance
Hi,
Try changing “FilterName” and “FilterMultiValue” with “FilterField1” and “FilterValue1”. Remove the * wrapping the query string.
Alexander
i was trying in sharepoint2010 ,
it seems it works in wss and moss2007!
Hi Alex:
Forgive me if I’ve asked this before.
I would love to find a way to use the best features of a Document Library (metadata) combined with a Custom List.
The attachment feature in a List is not sufficient as the library docs are stored in a relatively hidden and inaccessible file.
Do you have any ideas?
Hi,
What is stopping you from using metadata on the document itself?
I do not have any other feasible method for creating this “relationship” other than SharePoint’s lookup columns.
Alexander
Good Day A,
I need some help with jquery. I have several checkboxes setup where if you check it some text displays. fairly simple function like this:
This works well, but what I want to do is only show one link (area) at a time no matter how many checkboxes are selected. The area I want to show is the one closest to the top (in order) or the lowest number.
Example: If I check Sect 2 and Sect 3 only the area for Sect 2 displays.
If I select Sect 1 and Sect 3 then only the area for sect 1 displays. Also if only one is selected then that one displays.
can this be done?
Hi,
You would have to add a function to loop trough all the “containers”, checking if they are visible or not. Then based on your logic, decide whether to expand it or to leave it collapsed.
You would have to call this function rather than to toggle the container directly.
Hope this helps you on the way.
Alexander
Hey A, I know your busy and hate to bother you. I’m stuck on this. My skills are not good enough to figure out how to write this function to loop through.
Can you get me started? I think once I have some with an idea i can figure it out.
Here is a possible answer:
Alexander
that is perfect. So I have been playing with adding some formatting. each time I add something I lose the function. Initially had it setup in a table where I was trying to hide the last cell to the right. I removed the table and just added span tags, P tags just around the check box like this:
even like this
Still lose the function.
I know by adding the span around the input it changes its location in the node tree, but what about the label?. I’m just not sure how to identify it. I have tried several things, but like usual just cant hit the right one.
otherwise this works perfect, as requested.
never mind. thank again for all your time. I was able to figure it out to trigger the function again and added the content into a table.
thanks a million
Quick question I am able to show/hide fields based on selection in a survey using your script but unable to hide the msformlabels. It normally works fine but it is not working on a survey?
Hey Mark, check out this post:
https://spjsblog.com/2009/08/19/wrap-choice-field-in-multiple-columns/
A discusses how he added some extra to check if Survey or not. fairly easy to follow
Thanks Larry this did it.
Hi Alex, been a while, sorry that I haven’t send anything on the ‘rotating columns’ yet, it’s been quite busy here lately. Nevertheless, I can’t get my hands off of sharepoint, the challenge I’m currently trying to solve is to get the attachments paperclip in a listview clickable. Using a doclib and linking against the file is not an option since we are talking about a lot of files with the same name which should be stored with the list entry (one file per entry).
There’s a solution from Paul Grenier at EUSP, http://www.endusersharepoint.com/2009/02/12/jquery-for-everyone-linking-the-attachment-icon/ but that doesn’t work for large collections, so it’s not usable.
I thought of setting up the path ‘manually’, and displaying this entry, since I noticed that the attachment path is always like URL/site/lists/listname/attachments/list_item_id/filename. Though I might be able to come up with all the details up to the ID I have no idea on how to get the filename automatically.
Can you think of any other way to make the paperclip clickable to open the attachment?
Thanks,
Chris
Hi,
I have made a solution that will answer your request. I will try to get the article written during the weekend.
Alexander
Finally, it is posted List all attachments when clicking the paperclip in a list view
I have not tested it in a “large list” with many attachments, but i do not think it will be any problem.
Alexander
Hi Alexander,
I’m working with SharePoint 2007 and am trying to modify a list edit form. The result/outcome I’m trying to achieve is:
– Hide and/or replace the default ok and cancel buttons with my own options – approve, save, cancel.
– My buttons would update the value of a hidden status dropdown field on the form to a desired value (for use by a workflow).
I’ve tried to accomplish this using the action button within sharepoint designer, but have not had success. It seems as though this should be possible with some clever javascript – though I’ve been unsuccessful so far.
Any guidance is appreciated!
Travis
Hi Travis,
for a start, to replace the default texts within the form buttons you can use this code.
This will change the “OK” to “Save”. For “Cancel” I think the id$ has to be “GoBack”. I can’t help you with adding a third button though and for changing the value of a field I’m rather clueless too, maybe have a search for presave options to get more info on this topic.
Chris
Hi Chris:
This is not working for me in WSS. What am I missing?
Thanks-
Travis, here is some code to add a button to the edit form. Currently I am using this to add a Help button which launches a popup window with help information. Using Chris information, or search with in here A also has a script, you could rename your buttons. then you can add this script into a CEWP to get your third button.
Hi,
Here is another method of getting a third button (or more):
To interrupt the save process, use the “PreSaveAction()”. This function is automatically executed between the click of the “OK” button and the actual save.
Note that this function must return true for the save to happen.
Alexander
Charlie,
enter the code into a CEWP and place it below your form, that should work.
Chris
Alexander,
Have you created a script that forces users to click the drop down on the new button in a document library? This way you can force users to pick the appropriate content type, rather than having a user click the new button, which loads the default content type?
Look here: https://spjsblog.com/2009/10/19/maste-document-template-library/comment-page-1/#comment-4737
Alexander
Alexander – thanks for taking open requests. I have been trying to create iGoogle style page, see this URL http://nettuts.s3.amazonaws.com/127_iNETTUTS/demo/index.html to get an idea of what I mean. The user can at browser level move the widgets to any section on the scree. I was wanting the same functionality but wrapped withing SP 2007 web parts. Is this possible? If yes, can it also store the user settings in cookies? I am trying to use the Personlization Site of SP 2007 to achieve this.
thanks in advance.
Hi Rob,
I’m sorry, but i don’t think i can help you here.
Alexander
Hi Alexander,
I’m working with a Lookup field in a listview and I would like to change the default behaviour of the “close” button to return to the original list instead of the “lookup list”.
I think this can be done by adding a “&source” parameter to the close button I have no idea how this can be done. Can you help?
Chris
Hi,
The source must be in the URL when you load the form. If not, you must change the “action” attribute for the aspNetForm and add i there. In any case, you must have the URL you want to return to… Maybe the best method is to add some jQuery to your list view to insert the “Source” in the url?
One other method is to edit the close button behavior to go back one step (like hitting the back button in the browser).
Alexander
Oh, and I’ve got another wish. I’ve successfully implemented the Chart API with some pie charts. Now I’d like to display a sum of all the entries that a pie is created from. The google api doesn’t offer such a parameter. Is there any way to have like a heading for the pie’s that will count all items that the pie has been created of? Like a back-link to the view or something?
Chris
Hi,
This is not possible at the time, sorry.
Alexander
Am creating a SharePoint script library for various site owners within my organization to leverage (via a CEWP > Content Link).
This has worked very well for simple scripts that require no user customization – i.e. Christophe’s EasyTabs, Quick Launch toggles, etc.
The only “customizable” scripts we have are your Chart using Google Visualizations API based scripts. I created multiple configurations of charts from a single chart to a 3×3 table, using different div id’s as you suggest, and all is outstanding.
Is there a simple template you have to use this type of customization for other scripts – I have meandered through your js, and my head beings to spin (I am NOT js literate, but can manage to edit basic scripts to serve my purpose in most cases).
A few examples of scripts with universal value, but require some ability to customize are:
Scrolling text marquees (edit width, speed, text, etc)- I would think this to be a simple one
Customizing column widths in a List’Display (column name, width) – I would think this harder
Can you post or produce a template of the key parts to have a script:
– identify that no config list exists, and create as needed
– how to build the screen to allow the fields to be written to the config list
– how to pull them back into the script
I do not think I have a need to read data from a list (like the charts you have amazingly developed) with the exception of reading back the user created config values.
I can send a script or two (the ones re: above) if that helps!
Thanks for any guidance, and all that you have produced so far!
Hi,
I like the idea, but have little time at the moment and cannot promise anything. It sure sounds like a good idea though.. I will keep it in mind an maybe follow up on it when things calm down a bit.
Alexander
Alexander,
I am having problems displaying a week events view for a calendar information because of reoccurring meetings.
Would it be possible for you to create a jquery filter that could be used in a CEWP for the calendar current events view that would filter everything by a between specific dates?
I tried using the code listed here http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/d7be2bea-bab9-43a8-a7f6-b934f3b529bf but it did not work correctly for me.
thanks!
Sorry, but i cannot help you with this one.
Alexander
Hi,
I am using sharepoint Offic Designer 2007, to validate a checkbox(terms and conditions) thru javacsript.
Details:
I have created a custom list and in the custom there is a field called terms and conditions. I have inserted the custom list in custom.aspx page. I have changed the sharepoint checkbox to asp checkbox for validation purpose.
And I am trying to validate it through client validation function by aspx custom validator. My code looks like
function TermsValidate(sender, args)
{
args.Isvalid=documnent.getelementById(“ff2_1”).checked);
}
The validation looks like it is triggering but object required error comes up. Because “ff2_1” is a sharepoint control and it is not able to recognize the control field..
Does any one faced or come across this problem?
If you have validated sharepoint controls with javascript without changing them to apsx controls. I am keen to take that approach.
My requirement is I have to validate the checkbox field.
Thank you
Add this code in a CEWP below the unmodified SharePoint Form (NewForm.aspx or EditForm.aspx):
Read her how to add a CEWP to a SharePoint form page
NOTE: You must change the FieldInternalName “MyBoolColumn” in the function “PreSaveAction” to match your field.
Alexander
I would like to be able to resize the column header height (in Datasheet view). Currently, it only allows to resize the width. Is there any script I can use to do this? Thanks!
Hi,
Sorry, but i have no solution to this issue.
Alexander
Hi Alexander, I read this post about using webpart connections at EUSP: http://www.endusersharepoint.com/2010/08/25/sharepoint-filtering-with-web-part-connections/
Is there a way to use javascript to hide a column in the dispform.aspx? It needs to be there for the webpart connection to work, but I thought it could be hidden from view using one of your solutions.
Thanks for all you do!
Hi,
You write dispform.aspx, but do you mean in a list view? -like AllItems.aspx?
Alexander
Is there any way to eliminate commas, from a column type Number in SharePoint list using java script?
Thanks in Advance!
There are several methods to achieve this. I am going to post the 2 solutions. One from A that I believe works the best and another one I have pieced together.
Instead of using a number field you can use single line of text. the script below will only allow numbers to be entered into the field. It is treated as text in SharePoint and you cannot sum or average in a list view. Add Below NewForm or EditForm
To go the other route I have found placing a script on the list view removes the commas and returns a number. Add below the List view
I am looking to find a way to autopopulate a user’s manager name or account name to a field on newform.aspx. The information is in AD, we do have MOSS, and I know I can do it using a custom form and the current user filter web part. However, I’m trying not to use a custom form. Is there any way to pull this info? The manager’s name is visible from the My Site Details page, but not from the {servername}/_layouts/userdisp.aspx. I am already using Javascript to pull the other fields I need, manager is the only one I haven’t been able to get yet. Any ideas?
When using MOSS you have a webservice named “userprofileservice.asmx” that will “give” you this info.
Let me know if you need any help.
Alexander
I would like to create a New Form page which has a employee ID. When user enters employee ID, then the rest of the fields (like department, work phone, etc..) should populate, getting information from Active Directory. Is there a solution for this using jQuery. Thanks!
Hi,
You cannot query AD directly using javascript, but you can access the user info in the SharePoint database.
You have one example here
You will have to do some modifications to have it search for the user using employee ID, but it’s a start.
Alexander
I Have a two columns in a list
one is status(drop down)-(open, hold, pending verification)
other is status Description(multiline textbox).
can you help with javascript that validates two columns
I want Status Description to be required field, if status is not equal to open.
thanks in advance!
Sure,
You can do that using simple javascript. Open the form in SPdesigner Window.
Try to use the jquery and it can be done.
Need More help let me know. I will show you how to do that.
Hari
Hari,
Can you please show me how to do it!
Thanks in advance
Hi SPKID
You can do that using simple javascript. Open the form in SPdesigner Window.
Try to use the jquery and it can be done.
Need More help let me know. I will show you how to do that.
Hari
google.load(“jquery”, “1.4.2”);
google.setOnLoadCallback(function()
{
$(‘#your control id’).change(function()
{
if(condition )
{
your code;
}
else
{
your code
}
);
});
G’day Alexander, Love your work. You provide some excellent solutions.
I’ve got your SP Hit Counter functioning great on my Intranet work site.
https://spjsblog.com/2010/02/18/hit-counter-for-sharepoint/
My question is: For a generic SP Blog site, is there a way to count individual Blog Post hits? And have this counter displayed on each Post?
Not the posts that are default on the front screen but when the user clicks on each post within each category. ie: ../Blog/Lists/Posts?id=1
Your JQuery Hit Counter solution only works as a CEWP which would count every time the Posts.aspx page is loaded.
The solution I require is for the users to know the popularity of each Post. And I think a Counter would be the soultion.
Can this be done via a Calculated Column in each Blog? Or using DVWP for the HitCounter List? Or if you know of a better/easier solution, please let me know.
Thanks,
Brett.
Take a look at this one: Hit counter for SharePoint
I have updated it to support counting hits in a blog (or ordinary list).
Alexander
Hi, Alexander.
First of all – many thanks for your work and help here, so many interesting things you’re doing! This is great!!
I’m very interested to get a specific data in SP list – I mean data from external SQL table. As I’ve discovered in the Internet – it’s possible but so hardly ( for me especially 🙂 ) and many people said that it has many risks to connect to SQL DB from jscript because of security issues, etc. But in my case I have read-only access credentials to DB and want to get the data into list field from a table.
In my case I have many data about users in SQL DB and I want to use paste that data into SP list, so I could bring much power to lists ( or other SP elements ).
So, how hard is it – to tie together SQL queries and jscript ( for SP )??
Thank you very much in advance!!
Hi,
I’m sorry, but i have no knowledge about this issue.
Alexander
Greetings Alexander,
Got another challenge or humble request for you.
Topic: SharePoint Survey/Poll
Can JQuery be used for a single question Poll in a Web-Part?
So that when a User answers the question, it then displays a Results Web-Part, perhaps a Bar-Graph?
I can get the Poll into a web-part using this: http://www.endusersharepoint.com/2010/04/22/create-a-polling-web-part-with-sharepoint-designer-and-the-dvwp/
But no Results can be displayed after the user Votes.
I tried using this to display the Results but this will not show the Summary.ASPX of the Survey:
http://www.pathtosharepoint.com/sharepoint-user-toolkit/Pages/Cross-Site-List-Snapshot.aspx
Is there a way to do this via a Custom List?
Thanks,
Brett
Hi,
I will take the challenge 🙂 I will post a poll solution that support multiple simultaneous polls – with graphical summary. Keep looking for it during next week.
Alexander
Hi,
The poll solution is done, but i have not had the time to write the article. I will try to find time during the weekend.
Alexander
Hi Alexander.
i try to fill fileds with values in the Newform.aspx from a Customers list. Better, i have a lookup field to a customers List, i want dynamicly get the Values from this selected Customer and write them to fileds in my Newform.aspx. So i can make changes to these values. That changes where only saved in the new created item, not in the Customers list.
Is this possible?
Regadrs, Maik
Hi,
Take a look at this article Display information from another list based on a lookup column connection
Read trough the comments and you will find some more answers.
Alexander
Hi Aleksander,
thanks for your Reply. I already created a working soltution for me. It´s a mixed up of your
https://spjsblog.com/2009/11/28/dynamic-expandcollapse-fields-or-array-of-fields-by-multi-select/
and a Webservice call via jQuery.
Maik
Hi Alex,
i have another request or better question. I have a webpart on a Newform.aspx page. Here i can add a new item to a list. On my Newform.aspx is a lookup column to that list. How can i update that lookup column on that page when a new item is added to that list? When adding an item to that list thru the webpart, i make refesh that Newform.aspx.
Also how can i save value in fields on the Newform.aspx when refreshing that page.
Regards Maik
Hi,
I do not think you can add another item to a lookup without refreshing the form. It might be possible “hacking” into the javascript that is used to populate the original control, but i have no code examples available.
Saving items in newform is not possible without using some code to preserve the values and refill the form when refreshed.
Alexander
Hi
Apologies if this has already been asked but how how can I format Multi-select column results in DispForm?
Instead of seeing something like this:
value1;value2;value3
it will be
value1 | value2 | value3
or on seperate lines like this
value1
value2
value3
Thanks for you help
through the use or two CC i was able to take selected from a multiple select and display them in a table. The same basic principal can be applied to format your output any way you want. I dont want to take away from Alexander, but I know he is busy. So in the mean time you are welcome to review this 3 part article. If you like you may use it, or wait until Alexander has the time.
http://sharepointhacker.wordpress.com/2010/03/24/choice-field-multiple-select-multiple-columns-part-1/
Hi,
Sorry for the late reply, here is one solution using the init_fields_v2() function:
This code splits the HTML and joins it with a <br>
Alexander
I have a basic list view, I added an extra column to it in order to be able to filter on that column, using the Query String Filter Web Part. Now, I’d like to hide that column from view. How can I hide it via Javascript, so that its still in the view (similar to how you hide the ID column in this solution https://spjsblog.com/2009/11/17/preview-metadata-in-list-view-on-mouseover/)
Thanks!!
Hi,
Look here for another example on hiding columns in a list view
See if you can reuse some of that code.
Alexander
User specific NEW and EDIT aspx pages
Hello Alexander,
Imagine: a large list of items: e.g. “Products”, you are a independent seller between producer and customer. The Products have unique Names, but a order number (you use this to order at your vendors) and a sales number (You use this printing on you delivery papers for your customers)
So you hae a list with three columns (imagine ;)): Product, Order Number, Sales Number
Why ever, the purchasers should only able to add and edit Product/Order number; the sellers should only be able to add and edit Product/Sales number.
(In reality, there are more than 100 columns in this view, partially belonging to one of the departments, partially shared)
I am looking for an ADD/EDIT Script/Form/… which allows to restrict the purchasers/sellers to the columns they are PPR. So Purchasers can not edit sales numbers and vice versa, but are working on the same list.
Warmest regards
Michael
PS:
I can imagine to have a new/edit page for a list defined by a specifiv view, but did not know how to code this.
Looking at my request above: Puchasers have Purchasers View with Product /Order number and Sellers have Sellers View with Product and sales number.
Dreaming about a list with more than three columns (three may be solvable by lookups) it would be nice to have a edit/add new functionality only for the fields included into active view.
Best regards
Michael
Michael,
this should get you started.
https://spjsblog.com/2009/09/20/showing-or-hiding-list-fields-based-on-membership-in-a-sharepoint-group/
you can use A’s script to hide the fields from the two groups you described when they come in to edit the form. If you dont want to hide, use this script and set the fields to read only. II have done this before and it is a fairly easy change.
Larry thanks a lot for this link. That will be useful for an other project!
I need to clarify my request: I am interested in new/edit forms only coming up with the fields from actual view (not user). So, AllItem should edit all Fields, SalesView should only edit Sales fields. It would pretty nice if it is possible to have a general solution working with every view instead of adjusting every view with CEWP code containers. But I am willing to enter them into every view if that is the way to get this running.
It is also acceptable, if the answer is: Use Sharepoint Designer to set up view specific new/edit pages and jumping to them with a link from sharepoint.
If we dig deeper into this: if it is possible to have this edit/new based on views it may be helpfull to have some fields in edit mode on read only for all others than owners (and that will then bring up the script you mentioned).
Thank you for discussion, I would appreciate to go with discussion.
Kind Regards
Michael
Hi,
Interesting approach… I will try to make a solution like this, but unfortunately I’m a bit busy… Stay tuned and i will let you all know if i can get this to work.
Alexander
Hallo Alexander, I would like to help if it is possible. Would appreciate to help and learn.
Thank you for being interested.
Regards Michael
( may I ask if you can have a look on my post with this attachments issue?)
Hi,
My attempt to answer this request will be posted over at nothingbutsharepoint tomorrow.
Alexander
Hello Alex,
Thanks a lot. Answered already at Nothingbutsharepoint.
Wish you a Happy New Year 🙂
Kind Regards
Michael
Hi Alexander,
ltns, hope you are doing good. A couple of days ago a colleague came by and asked wether it is possible to execute SQL statements with sharepoint to manipulate lists. I thougt of this for a moment and I couldn’t see a reason why it shouldn’t be possible.
I’d just take your redirect script to manuipulate the “OK” button of a form and then insert the sql string instead of the new url et voila, case closed.
Turns out however that I haven’t found a single reference for client-side sql with javascript to have it run when a user clicks ok to save a form.
Is there a chance to get this running somehow? Jquery has so many addon’s but none of them deals with direct database connections.
regards,
Chris
Hi,
I do not think direct SQL is possible. You must go with the webservices and CAML I’m afraid.
Alexander
Hi Alex,
I want to know if it is possible to send an email that contains multiple list items. For example I want to send an email to person A that states person 1,2,3 has successfully completed a task on a sharepoint list. Is this possible? Any help or anything anyone can point me to will be greatly appreciated.
I think you should create a Workflow for this scenario. You can use Javascript to send an email – indirectly:
Send email with javascript – with the help of a workflow in a dedicated “send email-list”, but i think WF it he best way here.
Alexander
Hey A,
I know you posted some data on how to prepopulate multiple line text fields. I have been trying to expand on this. I have an intake I use that most of the responses are 1 of 4 general sentences. I have been trying to add some click text that will populate the multiple line field based on what I click, but only change the existing populated text if a new item is clicked.
Click option 1, multiple line field = option 1, if I now click option 2 multiple line field = option 2, option 1 text is deleted from field.
I have thought maybe even radion buttons, but I cant either to fire on click and populate field.
Hi,
Are you using the “setFieldValue()” script?
How have you created the clickable text?
Alexander
Hey Alexander,
I have a catch-all document repository set up with some mandatory fields that I want the user to specify before they can upload the document. The mandatory fields /metadata (meeting type and meeting date) helps my workflow to route the document to the appropriate meeting site and know when the document needs to be reviewed. Problem is, SP uploads the document and THEN asks for the meta-data. If the user doesn’t supply the meta-data (presses cancel) then the document is still uploaded to SP but is checked-out and only the user can view it (I can’t).
What I was wondering if JQuery could do is make SP ask for the required data before the upload process and therefore the user would be forced to supply the required fields or the document would not be uploaded and shown on SP. Alternatively, another solution would be so that if they hit “cancel” then the document would be automatically deleted from SP or whatever temp folder it is held in.
Thanks!!
Hi,
A couple of possibilities:
1: Hide the Cancel button
2: Have a Workflow delete the item if the required field is not filled
I do not have a jQuery solution other than hiding the Cancel button.
Alexander
Thank you for the response Alexander:
1) Since the Update page is used by other doc libraries do you have a suggestion for just editing the cancel button on certain pages? Similarly, regarding how to hide buttons – do you know if it is possible to hide the date-picker control (not the actual textbox – just the calendar icon) in a form?
2) Unfortunately, I tried this but a workflow won’t kick off b/c the document is never actually uploaded fully. Instead, the document is shown as checked-out and therefore a standard SP workflow doesn’t get kicked off. So I literally have no way of knowing the document was ever posted.
Here is some script from A, some time back to hide the cancel button
[sourcecode]
<script type="text/javascript" src="/sites/globalmp/JavaScripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$("input[id$=’GoBack’]").hide();
</script>
Hi,
You are right, i forgot about the document not triggering a WF upon upload… I did actually write an article about that though…
Here is a method for hiding the datepicker image:
Put this below the form webpart. The FieldInternalName of the date and time field in this example is “MyDateTime”.
Alexander
Thanks for the help Larry and Alexendar!
I have a custom SharePoint list, being used as a request form. There are 2 particular fields I would like to use for validation. One Drop Down, one Date Picker, so that the form errors on submit if invalid.
Based on Drop Down Selection (Choice 1, Choice 2, Choice 3) the date picker needs some validation on form submit.
If Choice 1, Selected Date must be a Tuesday, and must be at least 7 days from [Today @ noon]
If Choice 2, Selected Date must be a Thursday, and must be at least 7 days from [Today @ noon]
If Choice 3, Selected Date must be third Friday of the month, and must be at least 30 days from [Today @ noon]
Any help you can provide will be greatly appreciated! Thanks!
How do I make sure a numeric has no commas, if the user types in 1994, sharepoint will reformat to 1,994 and I really just want 1994
The number formatting is given from the regional settings in SharePoint. Create a new calculated column with the formula: =TEXT(MyNumber,”0″)
MyNumber is the name of my field – replave it with your field name.
Alexander
Hi Alex problem with the solution of TEXT(MyNumber,”0″) is that it shows on the edit form with the comma
You could use a script to strop the comma away in the EditForm, but if you switch to a text field you have “fixed” the problem… Loosing all the number-function though…
Read here for a previous discussion on the same topic
Alexander
I guess the question then becomes how can we limit only numeric entrys into a string field
This will strip off commas in EditForm (place in CEWP below the form):
MyNumber is the FieldInternalName of the field.
Alexander
Is it possible to hide values in a dropdown of Lookup, choice or the time values? I thought I recently read this was done on a lookup, but cant find it. I need to hide some houre on the time for a date field. is it possible?
I did find it in March 2010. It appears it only check the date, not the time How can I check the time and compare the date/time?
Like this:
The date and time field in this example is named “MyDateTime”.
Alexander
slam dunk. That was perfect! I believe you also did a date compare, Enddat cant be less than start date. I believe it only looks ate the date, not the time. How can I compare dates, including the time?
If you find the script – look at the part with “…= new Date(…”
Here the date object is constructed like this:
new Date(year, month, day, hours, minutes, seconds, milliseconds)
You can read the hour from the select and use it in the constructor.
Read about it here
Alexander
thanks, you’re the best!
YOU ARE MY HERO!!! Your site is extremely resourceful!
How can I get a ‘Recently clicked links’ in a web part page?? Cookies?? I have 10000 users
Hey A,
Sorry if this replicated, I cannot see the post.
I really tried not to bother you with this one, but I have been unsuccessful in locating a solution. I need to calcualte the third friday of the current month. I tried to modify a similar script for a US holiday, but no success. If you have some time can you take a loook and let me know what i missed?
If you change it like this it will work:
Alexander
Hey A, thanks for the above code. Great help.
I have new request, not a hard one. I just cant get all the syntax correct. I have a list view, setup in the Preview Pane style. With the help of jquery I have removed the .ms-formlabels, and the first TR, which contained the Title. The background color is a little dark so I began playing with opacity. I know that this affects the child also, which is my problem. There are several solutions to get around this, but I can implement the solution.
This is what I have
I can not figure out how to wrap the child, or the text in the preview so I can set the css. There appears to be a DIV tag, but cannot confirm if this is always true for each preview. If I can set the css I can off set the opacity of the child.
Any thoughts or suggestions?
I’m no expert at this, but i think it will be hard to have a different opacity for a child. Why not just add a brighter background color?
Alexander
Hi Alex,
I’ve been frustrated by what should be a simple solution. In Excel I’m able to determine if a task is past due by comparing the start date/time to Now(). Unfortunately, SharePoint doesn’t support Now() as a filter option in a view, so I’m only able to use [TODAY], which only shows tasks when they are at least 1 day past due. Do you know of any JavaScript I could use in a view to show all past due tasks as of that day and time?
Any guidance you can provide would be greatly appreciated as it would save considerable time in identifying tasks that are passed due throughout the day.
Hi,
Look at this one Compare DueDate with Today in list view
Note: It relies upon the date and time on the client computer and therefore is not guaranteed to show correct statuses…
Alexander
You have great site. I have 2 requests maybe you can help with. Star rating for MOSS or SP 07 and a flyout menu for the top navigation. I know by default the top navigation offers 1 level dropdown (or is that considered 2), but this is not enough. I have tried many different solutions that required modifying the master page, but not the results I need. Is there is a way to add a tab or 2 (maybe more) to the top navigation that pulls data in from a list, that populates the menu based on the list structure.
Maybe there is a field “Category”, “Level1”, and “Level2″… then the menu builds based on list data.
thanks Tim
Hi,
Star rating has been requested many times, but i have not yet been able to find time to do that – i guess you have found this one Ratings for SharePoint lists
A fly-out like you describe is possible to make, but if you do not put it in the masterpage, you will have to add code on every page where you want it to appear…
Alexander
I dont mind using the master page to implement, I have not been able to find a good solution. Looking over all the work here, it almost appears that you have built many scripts linking to another list. Just though this would be fairly easy. I do like the Ratings for SP list, but the Stars would be better. thanks for your time.
Hi,
I will keep this one in mind, but i cannot promise anything regarding “delivery”.
Alexander
Hey A,
I need you expertise again. I am playing with a script from Jan Tielens Search as you type jquery script http://weblogs.asp.net/jan/archive/2009/07/02/sharepoint-search-as-you-type-with-jquery.aspx. By default this searches all sites and i am trying to search a single list or library. I have sent a request, but no response so I did some research and found that this is fairly easy to adjust, the problem is I cannot figure out the correct syntax. in the script line 9-15 it is setup with the search parameters including the scope “All Sites”. in the CAML I read you can add a string to the QueryText. I cant figure it out. in the script line 159 this is the text
[sourcecode]
<QueryText language=’en-US’ type=’STRING’ >SCOPE:"" + quickSearchConfig.scope + """ + query + "</QueryText>
I should be able to add SITE
[sourcecode]
<QueryText language=’en-US’ type=’STRING’ >SCOPE:"" + quickSearchConfig.scope + """ + query + " SITE:"mysite"</QueryText>
but I cant figure this out. Can you shed any light?
Sorry, but i do not have any experience with the QueryText syntax.
Alexander
Alexander,
It’s been a while since I’ve been here. I still use loads of the incredible code you’ve developed. Thanks a lot! I’m not sure if what I want is possible, but if it is you are the person to tell me!
Here’s my request: I use your “tabs” code for display, edit, and new forms. There is an attachment tab. I want to be able to create folders for these attachments – or some other way of organizing the files.
Thanks as always!
Hi,
I do not think it is possible to add any folder structure or metadata to the attachments. The attachments are stored in the …/sitename/Lists/Listname/Attachments folder – in a folder named using the list items ID.
To achieve this you would have to store the attachments in another library and “routing” attachments to that library, linking them to this items ID. Then use some custom code to retrieve the attachments and display them in the list view and in DispForm/EditForm.
This would require a lot of work and i do not have any examples to give you at the moment.
Alexander
Thanks. This is what I needed to know.
I want to redirect users to mobile site , if they open main site in mobile page?
can you suggest me any javascript ?
Thanks In Advance!
I want to redirect users to mobile site , if they open main site in mobile page in sharepoint2010?
can you suggest me any javascript ?
Thanks In Advance!
am using below JS to mobile redirection ,
But its not working some of BlackBerry versions example blackberry9000
do you suggest any other script to do the same?
Thanks in advance
Hi Alexander,
Very nice work!
I’ve spent lots of time searching for a simple way to stuff a date/time stamp into a list field, so that I can capture custom timestamps for specific activities. UTC – 5 would be fine for all. I can generate the string, but can’t figure out how to pass it to the hidden form field, as in “field xx Value=CallmyTimeStamp()”
I’d love to see you post something; I can’t believe there isnt huge demand for this…
Tim
one more quick request. How can you hide the fields on a New Edit form of a calendar FieldType=”SPFieldAllDayEvent” and/or FieldType=”SPFieldRecurrence” some reason I think the function misses these. I dont understand regex to figure this one out.
Never mind, this was my fault. I missed the function call.
hate to bug you again. I am trying to build a presave function to check the value of a radio. when the field is a dropdown I can get it to work with this
[sourcecode]
var myAccurate = $(fields[‘Accurate’]).find(‘select’);
var myAccurateVal = myAccurate.find(‘option:selected’).text();
function PreSaveAction(){
if(myAccurateVal==’Yes’){
if(confirm("Are you sure field "Accurate" should be "Yes"?")){
return true;
}
//return false;
//myAccurate.focus();
}
}
I searched all you request posts but could not find the syntax. I found checkbox but not radio. If you have a minute can you help?
Hi,
I have been cut off from the Internet for nearly 18 hours caused by someone digging over my ISP’s main cable.
Do it like this:
Alexander
that’s exactly it. You Rock!
Hey A, sorry if duplicate. I tried to post this yesterday but I dont see it. I am still working with the presave function. When I try to get the date val in an alert the val is blank
I’m I missing something?
Nothing wrong with that code. Ensure the FieldInternalName is correct and that you have created the fields object.
Alexander
Hi Alexander,
A humble request for your masterful code-wizard skills.
I’ve got a SharePoint 2007 Blog site rockin in my Intranet environment at work, also got you vertical scrolling web part which on the main page showing the latest posts and the Hit/Like Counter on each Blog Post.
What I’m trying to find a solution for, is a “Related Posts” web part, which is displayed next to each blog post, which can be either a list of posts from the same category or even posts that can use a Search Query to display “Related Posts”.
I’ve tried Googling “SharePoint blog related posts” and it displays every Blog site on the web… frustrating.
Can this be accomplished using the Data View Web Part?
Do you know of or are you able to provide a solution for this common ailment in Blog Sites?
Your time and efforts are much appreciated and I think you deserve some kind of Charity Medal for the free solutions you provide. 😉
Thanks, Brett.
Have you tried the “Search Box” and “Search Core Results” web parts? These are much easier to use then defining a search scopes and give you the ability to set specific parameters. I just started playing with this after abondoning the Search Scopes and I am very pleased with the results. I believe you may be able to tweak these to fit your needs. If interested let me know and I will post a quick tutorial, not to take away from A’s great work.
Sounds great Larry, anything to get something working on my site.
I’m interested in how you can have the search query based on the Category of Video is being watched at the time and display the results in a web-part.
I did see a working solution at the SP Conference in Sydney, Oz, last week but it was for SP2010 and he used a Search Results Web Part also.
Hit me up when you have something and I’ll give it a crack.
Cheers, Brett
I haven’t had the time to write up a full detailed descrition so here is the infomerical cut.
1. In Site Actions >> Site Setting, turn on SharePoint Search Webparts
2. For practice create a Web Part page. Later you can export/import or recreate in any other page
3.Add two Web Parts
a. Search Box
b. Search Core Results
4. Modify the Search Box Web Part
5. Select option “Do Not Show Search Scopes in Dropdown”
6. For the Query Textbox, get the URL for your list/library. No last slash. Example: http://path/Library/Forms/AllItems.aspx URL = “http://path/Library”
7. Additional Query Terms, ‘site: “http://path/Library”‘.
this is important how you format. two parts
site: and the URL in quotes. You need the quotes
8. Uncheck append Additional Terms to Query.
9. Give it a name
10. Target, change to current page, can use relative URL.
11. click OK
give it a run. once you get it working there are other tweaks you can add and remove to modify your results.
Thanks a bunch Larry, I’ll give this a try at work 2morro and let you know.
Off topic Q for the floor: Does anyone else, ie: SP Designers/coders, constantly think about ways to improve an SP site? While driving, watching TV, during conversations, going to sleep etc… 🙂
Larry, Got it working but I still have to physically type in a Search Query to display the results.
I’m gunna try a solution using the Query String (URL) Filter and see if I can display the Posts. Cause all I need is to display the list of posts from that Category of the Post that is being displayed.
Hi Alex,
another challenge from me…I’ve got a doc lib with two folders and basically three types of groups.
Folder A – Content visible to Group A and C,D,…
Folder B – Content visible to Group B and C,D,…
In other words, Group A and B only see the content of their respective folder whereas all other groups see the content from both folders.
The views have been defined to show content without folders at all, just using metadata to sort the information.
That’s where my problem starts. When someone uploads a document to the lib – in a non folder view – it is always placed in the ‘root’ folder instead of ‘automatically’ in the Group A or B folder. I don’t want to change the view to display folders so I’m looking for a way to change the upload to go to Folder A when someone from Group A uploads a document and to Folder B when someone from Group B uploads a document.
I’ve tried setting the rights for the root folder to read only but then the “upload” menu vanishes and no upload at all is possible for A or B. Can you think of a way to have the uploads go to the correct folder automatically, depending on the group membership? Group C,D… have access to a view that displays the folders.
thanks,
Chris
Hey Chris, I know A is busy so I thought I would throw in my 2 cents in. I remember finding an article on EUSP some time back related to created folders that linked to views, not the entire scenario you’re looking for. So I did some research and I found several articles that might provide you with what you need. The first 2 part article is about the use of content organization
Part 1: http://blogs.technet.com/b/speschka/archive/2009/10/30/sharepoint-2010-content-organizer-part-1-a-cool-new-feature-for-managing-your-content.aspx
Part 2: http://blogs.technet.com/b/speschka/archive/2009/10/30/sharepoint-2010-content-organizer-part-2-organizer-settings.aspx
then I found an article that uses the SP WF to copy items into doc library folder using SPD Activities on codeplex:
http://social.msdn.microsoft.com/Forums/en/sharepointworkflow/thread/2a3c5e5b-4fb2-4d8a-8e1b-0d56d032fece
I hope these are helpful.
Larry, sorry for the really late reply. I’ve had a look at the site the day you posted them but was distracted by someone so I forgot to come back and report my findings.
The technet links look promising as far as I understand the content the ‘content organizer’ will add some sort of ruleset filtering ability to doc libs which might be worthy for further investigation as soon as I have access to a 2010 version 🙂
The msdn link has some good ideas, unfortunately not usable for me, since a) I can’t use spd at work and b) I’m not skilled enough to code what might be needed to accomplish the task.
So…I kinda moved back to ‘old school techniques’ by creating another view called “upload” which only shows the two folders and writing a howto for the users to use this view and the appropriate directory to upload their files.
et voila, it’s working 🙂
Chris
Is there a way to hide the appended comments to a multipe line field with version control. Actually can it a a click hide/show, and can it display the last comment by default? click it the see all pervious comments.
This would be on the Disp or Edit form where the user time stamp and comments are displayed
I saw this post and figured this is easy to do. Well not really. I am close. The is something about the comments that i can’t figure out. They all appear to be wrapped in a div, but not all of them are hiding for me. This code will toggle the comments (most of them) on click of the first one. Maybe A can lend a hand.
Hi,
I have posted a possible solution here
Alexander
Hi All, I’m trying to find two solutions in my SP 2007 Intranet.
1: Mega-Drop Down Menus on the TopNav bar possibly using JQuery/CSS. Has anyone got a working solution or code I can throw in my Default.Master?
I’ve looked over this post: http://tothepoint.inproc.com/creating-mega-drop-down-navigation-in-sharepoint-2007-with-jquery/
but his instructions are poorly written compared to Alexanders’ and incomplete. (No JQuery)
2: A pre-configured Button that auto subscribes the current user to a List (Posts in a Blog). Instead of the user clicking on Actions, Alert Me, choose what settings, click OK, all they do is click a button and bam, they’ve set the Alert.
This Blog sorta explains something like that but not exactly what I’m after. http://moblog.bradleyit.com/2009/03/cross-iframe-scripting-in-sharepoint.html
If anyone can provide some help with these, that would be splendid.
Thanks,
Brett.
Hi,
The “Mega-dropdown” might be something i will look at in the future, but the auto subscribe is not possible using webservices so i do not think this is possible using client side code.
Alexander
Hi Alex:
Here’s what I’m trying to do. On a SharePoint page, the user sees a split page with the first of many documents OPEN on the left and sees a NewForm on the right. She reviews each document for specific items and checks yes/no, etc. on the NewForm.
When done with document #1, the user saves the NewForm, clicks a left arrow to advance to and open the next document and a new NewForm opens to start the 2nd review. The NewForm data is stored in a List. The documents are preferable stored on a Shared Directory.
Ideas? Thanks-
Charlie Epes
Buffalo, NY
Hi,
You might be able to do this using iframes and have two refreshable pages side by side, but do not think i can help with this one, sorry.
Alexander
I have been working on a script that will auto expand all calendar events in a calendar view. I have found bunches of scripts that come close but none of them manage it all. What i have found with the scripts is they do not work on recurring events. Infact when the script is ran recurring events are no longer visible.
Here is one
[scriptcode language=”javascript”]
/*
//Expant all events onload
var yScroll = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop
var y = window.innerHeight || document.body.clientHeight || document.documentElement.clientHeight
var xScroll = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft
var x = window.innerWidth || document.body.clientWidth || document.documentElement.clientWidth;
var cover = document.getElementById(“cover”);
cover.style.height = (y + yScroll) + “px”;
cover.style.width = (x + xScroll) + “px”;
function expand() {
if (document.referrer != location.href && !location.href.match(/CalendarPeriod=((week)|(day))/i))
{ GetMonthView(‘11111111’); }
else { cover.style.display = “none”; }
}
window.onload = function() { expand(); };
[/scriptcode]
here is another
[scriptcode language=”javascript”]
_spBodyOnLoadFunctionNames.push(“ensureExpanded”);
function ensureExpanded()
{
var links = document.getElementsByTagName(“a”);
for(var i = 0; i<links.length; i++) {
var s = links[i].innerHTML;
if(s.indexOf("more items") != -1)
{
GetMonthView('1111111');
return;
}
}
}
[/scriptcode]
can you see what needs to change to get the recurring events to work the same? or maybe you have your own.
Sorry, but i have done very little in calendar views and cannot help you here.
Alexander
Hey Alex,
i need a JavaScript , where i can validate a share-point list column type single line text to enter only numbers.
Thanks in advance
Hi:
Try this:
http://www.cambiaresearch.com/c4/029c978b-aac5-472e-97a8-95b256f5febd/How-Can-I-Use-Javascript-to-Allow-Only-Numbers-to-Be-Entered-in-a-TextBox.aspx
Charlie Epes
Buffalo, NY
Sorry… Alex did this here:
https://spjsblog.com/2010/06/17/numbers-only-in-single-line-text-field/
Charlie Epes
Buffalo, NY
here is a script from A:
Hi, is it possible to have a dynamic Web Part title? So for example, I have a List that contains projects and their status. On my home page I have a view exposed that filters on the projects in Red status. The title is “Current Red Projects” but I would it to say something like “Current Red Projects (8)” where the count is dynamically appended to the title.
Thanks for all you do!
Hi,
It is possible, but you would have to use JavaScript, counting the items and updating the title.
If you use FireBug (Firefox) or Developer toolbar (IE) you can inspect the page to find what to count and where to put the result.
Send me a screenshot and i can see if i throw something together.
Alexander
Hi Alex,
I’ve got a new idea to improve things at work but as always, I’m lost when it comes to code it. My colleagues have to maintain two lists, one for orders, a second for inventory. Both contain similar info so they have to enter some info twice.
The idea is to create a button, e.g. in dispform of an order list entry which will copy selected (pre selected, not user selectable) fields to the inventory list, similiar to the cascaded dropdowns with source and target field mapping.
Using the button will have to check existance of the entry in inventory list based on the selected fields, if found update, if not create new. Best would be if also a link to the inventory entry could be created in the order entry.
Sounds weird, does it? 🙂
Chris
Hi,
I would need some more details or a quick sketch to get the full picture. It is definitely possible, but it might be a little to custom made to be of general interest.
I could look at it and maybe do a custom job for you?
Alexander
Hey A, Been a while and hope you are well. I have enjoyed using and modifying your scripts. I have ran into a little issue, no fault of your’s. I am running several of your script on a single page. the page load performance has been drastically reduced to a crawl. I can live with a slow page load, but the problem is the page goes white and it looks like it is finished loading. Perople think it is broken because there is not way to determine it is still loading. I was thinking, is there a way to initially display the SP gears image on the page untile the page is loaded then hide the image? I have been trying to get this to work by added the image to the page and trying to hide it by ID in the document.ready function, but no success. I know there easey thing to do is remove the scripts, actually built it in infopath, but too late for this now. Is there a way to display a loading image before the page is completely loaded?
Hi,
To have the image rendered *before* the page has finished loading is not possible, but you could do it by delaying the call to the “long running process” by a millisecond or two to ensure the picture is displayed before freezing the screen.
Alexander
that is a great idea, do you have an example how to delay?
Hi,
Something like this:
Alexander
it is amazing how you spit this stuff out. So what would cause the overlay not to close or be removed. It seems to work, except not removing.
never mind, it was a conflict. I was able to figure it out. This is great thanks again
Hi Alex,
im looking for a way to hide Columns in the DispForm and EditForm.
Something like you described here: https://spjsblog.com/2010/02/16/filter-list-view-based-on-membership-in-sharepoint-group/
But the columns should only be Visible to a person that is chosen in a peoplePicker Column in the same ListItem. Additionally the column should be always visible to specific Persons/Groups.
Something like this:
If (CurrentUser==PeoplePickerColumn || CurrentUser==CEO)
showColumn();
Can this be achieved with one of your scripts?
Do we have any javascript to disable edit item on a sharepointlist?
i want to allow users to add the items but not editing items.
any thoughts?
Hi,
You can override the ecb-Menu, but this would be for that page only and users have multiple entries – including writing the URL directly. I would suggest putting some code in EditForm itself to “redirect” the users away – to DispForm for example.
Alexander
I believe you can create a custom access level and remove the Editing list item. Then apply it to that list for all users. It will allow you to create new items, but not editing. DO NOT modify an existing access level, copy or create a new one to edit.
Hi,
You are right Larry, but be aware that running a workflow (that modifies the current item) requires edit rights.
Alexander
Hi,
I posted this request as comment in one of your post. I am posting it here again.
I am working with a workflow (using AgilePoint workflow for SP2010) which uses list default edit form as workflow task form. It shows and hides fields based in workflow configuration.
Say I have task A, B and C. In task C I show certain fields (which are hidden in task A and B) and in this task this field is mandatory. If I set field as mandatory in SP2010, the form expects the fields to be entered even in task A and B (where they are hidden).
Is there a way to set fields as mandatory from javascript? I get the task Id from query string, I feel I may be able to use this value to check for the field and check if value is entered by the user.
Thank you.
Cheers.
Hi,
You could use this solution: Get or Set value for SharePoint field in NewForm, EditForm and DispForm (Get only in DispForm) to get the value for a field and check if its filled in PreSaveAction like this:
Alexander
Hi Alexander,
Got an awesome request for your mad skills.
Are you able to provide a Javascript/Jquery code for a Comments Box Web Part? So it can be added to any page, list or library?
I’m thinking you could set it like the Poll web part, where the Admin can specify the ID Name for each Comments Web Part instance, which will allow the user comments be allocated to the corrent web part.
So it would function exactly like the Comments Web Part in a Blog Site, using the authenticated user credentials and/or anonymous comments if you desire.
There are a few Posts mentioning DVWP’s and SP Designer but I’m hoping to use a Javascript based solution.
I’ve looked everywhere for this function and closest I found was this Post.
http://devgrow.com/simple-threaded-comments-with-jcollapsible/
Many thanks for your time and efforts,
Brett
Hi,
Thank you for your donation.
I will look at this and see if i can put this together. A few questions:
What type of comment-field: single line or multi line, rich or plain text?
Shall the comment be visible above/below the comment field?
If you have any specific ideas, please e-mail me a sketch.
Alexander
Hi Alexander,
I’ve emailed you some details.
Brett
Thank you, I will look into it and post an article when I’m ready.
Alexander
Hi Brett,
Take a look at the solution
Alexander
Alexander,
Thanks for everything you do on this site. I find myself coming to it almost everyday for your javascript advice and help. It’s helped me out numerous times at work for a few of our sites.
I do have a question if you aren’t too busy with other requests.
I’m trying to modify the “Upload” button in a Doc Library. I would like to 1) change the name of it to something less vague, and also 2) remove the “Upload Multiple Documents” link completely.
I know this can be done by accessing the Central Admin, but I don’t have access to that since it’s a bit above my pay grade (if you know what I mean). If you could help, I would be grealy appreciative!
Thank you so much,
Jay
Hi,
The upload page is shared between all libraries in all site collections on the server. You cannot modify the page for one library.
I have however done a “hack” to make a custom upload page using an iframe and some jQuery to hide all unwanted bits and pieces. I will try to find time to write a short article on it.
Alexander
Hey A, it has been a while again, but I always enjoy coming back to this site. Every time I return I find a piece of code I can use some where even if only one line. Today I have a request for knowledge. in ShP 2010 the new and edit forms open up in a litebox type of a window. I have a few lists that link to a single list by a lookup column. I have added a link below the field description so the user can click it to add an item to the parent list. It even opens in the popup like window. the problem is even if an item is added it is not refreshing the field to show the new value. I have to close the form and reopen it for the new item to show. Is there a way to refresh the popup so the new value will display?
Something else I noticed. It doesnt matter if the form is in modal or the newform.aspx. when user clicks to add an item to the lookup and returns to the page it does not update. I can refresh the newform and is still will not display. I guess this is a bit more then a refresh. Maybe have to reload something, the data thaty populates the fileds? any thoughts would be helpful as always.
Hi Larry,
Thank You for the donation.
I did a test using two lists. I made a lookup column from list A to list B. I then opened lits A and saw one item in the lookup field. I left the dialog open and in a new tab added a new item to list B. Upon return to List A’s dialog – the lookup column did not update (as expected), but when i right clicked in the dialog and reloaded it, the lookup column showed the new item.
Is this not the way you found it?
I do not have a way of reloading the lookup column without reloading the form.
Alexander
Hey A, thanx for looking into it. I’ll let you know if I find something myself
Hello Alexander,
Using the Content Web Part and JQuery combination is great for ad hoc styling and effects for lists but is less accessible to end users.
One possible approach could be to place the script in the itemstyle.xsl and then the script could be applied to CQWP and Summary Links simply by selecting it as a display option.
For example, if I had a list containing a title and description, it would a powerful feature to simply select an accordian style to display the titles and then selectively reveal the desriptions via the accordion effect.
This would be great for News, FAQs etc. where the description might be long but you would like to see the complete list of headlines or questions.
Is this feasible and could you provide a worked example ?
Cheers
John
Hi,
The file you refer to is server side and not in “my line of business”, sorry.
Alexander
Hey A,
Is there a way to add some kind of functionality that would allow time tracking? When you open the form to create an item, a timer runs, maybe visible, maybe not, and when a status or task name changes the timer writes this amount to another field (maybe workflow). May there are 6-10 tasks, each item has there own time field, based on the task it will update or add time to that field.Maybe what I am looking for is the timer, a way to grab that data and a way to reset or restart the timer.
Hi,
I do not think this is feasible using client side code. The timer would exist only in the “browser window” and a refresh of that page would restart the timer. I believe a workflow could be done, but 6-10 timers in one item might be a bit messy.
Alexander
Is there a way to generate a dynamic link to the editform and hove it open in the modal for SP 2010? I am trying to build links back to the source item from different site, but I can not make it open in the modal. do you have a way using the calculated field that can generate a link back to an edit form that opens in the modal for SP2010?
Tim,
I recently have been working on something similar and was able to achieve this. Without taking anything away from Alexander. Through the use os Christophe script HTMLcc, 2 CC and a small Script I was able to generate a modal popup bak to the edit or disp form.
I created a CC call URL, this contained the link to the editform
[sourcecode]
="http://sitename/Lists/ListName/EditForm.aspx?ID="&%5BID%5D
I was already generating an ID using a workflow, so It was visible in the CC. I am sure there are other ways to grab the ID.
Second CC had my link formula and an edit image so it looked like SP
[sourcecode]
="<div><a href=’"&[URL]&"’ onclick=""return OpenDialog(‘"&[URL]&"’);""><img border=’0′ alt=’Edit’ src=’/_layouts/images/edititem.gif’ /></a></div>"
I add this CC to a view. On this view I add the 2 scripts in a CEWP
HTMLcc
and the modal. I can not rememeber the source but if you search I am sure you will find it.
[sourcecode]
<script type="text/javascript">
//User Defined Function to Open Dialog Framework
function OpenDialog(strPageURL)
{
var dialogOptions = SP.UI.$create_DialogOptions();
dialogOptions.url = strPageURL;// URL of the Page
dialogOptions.width = 750; // Width of the Dialog
dialogOptions.height = 800; // Height of the Dialog
dialogOptions.dialogReturnValueCallback = Function.createDelegate( null, CloseCallback); // Function to capture dialog closed event
SP.UI.ModalDialog.showModalDialog(dialogOptions); // Open the Dialog
return false;
}
// Dialog close event capture function
function CloseCallback(strReturnValue, target)
{
if (strReturnValue === SP.UI.DialogResult.OK) // Perform action on Ok.
{
alert("Issue has been submitted!");
}
if (strReturnValue === SP.UI.DialogResult.cancel) // Perform action on Cancel.
{
alert( "Request Canceled!");
}
}
</script>
The reason I went this route is I used another script of Christophes Cross Site Snap Shot. It was in the cross site view, none of the pages would open in modal. This work around got me there.
if you have any questions let me know.
Hey A,
I have a good request for you. I would like to build a menu structure using a SP List. JQuery has a plugin called Superfish http://plugins.jquery.com/project/Superfish. looks like it can create a great menu structure with multiple levels. If the menu items could be maintained in a list that would make it easier for the enduser to maintain it.
Let me know what you think.
Hi,
Finally i got to look at this one – have you done anything regarding this yourself?
I will be posting an article on this in the beginning of next week.
Alexander
Hey A,
I am stuck on a small JQ issue. I know you stated you dont really work with calendars, but I am stuck. I want to launch the event in a new window. I noticed there already is a target set to “_self” I add this
[sourcecode]
<script type="text/javascript">
$(document).ready(function() {
//alert($);
$(‘.ms-cal-monthitem a[href^="/SiteDirectory/marketing/ce/Lists/Calendar/"]’).attr({target: "_blank",cursor: "hand"});
});
</script>
and I can view code and it changes the target to “_blank”. my problem is it wont oopen in a new window. Can you provide any input?
thankls
Hi,
You must address the onclick event. It overrides the href attribute.
Alexander
thanks again, you rock!
Hey A,
I need to pick your brain. I am using jquery to pull a filtered set of data from a list. It is using caml to get the filter. What I what to try and do is create a rolling date filter. either pull items from last month, last 3 months or last quarter. I know from within caml this may not be possible.but I figure if I can add calculated columns that either return MMYYYY or QtrYYY, there should be a way to to get last “Month” or last “Quarter”.
If anyone can do this I know it would be you. Again I dont need the entire solution. I am already pulling data down with a caml query. I want to figure aout a way to filter that date data
Also if there is a way to use external data, like from a dropdown where the user can input and filter. The date is really killing me. having the ability to show last month or last quarter by default would be very kool
Hi,
Try something like this:
Alexander
Hi Alex,
I hope your sumer is going well. Do you know of a web part or a solution that would list all sites in a collection that a user has permission to see? For example, if the collection has 100 sites and i have permission to view, edit, contribute to 25 of them, the list or links web part would show “my 25”?
Thanks,
Charlie Epes
Hi Charlie,
I do not have a JavaScript way of doing this. If you try to iterate trough all sites, you would get a login prompt when you hit a site you did not have permission to view. I do not know how to suppress this login and skip the site.
Alexander
Hello Charlie, I have had the same question in our company environment (2007)´. I found a Microsoft fix/update, which was not installed from the IT group ( I am only a user….). It is a OOTB solution.
After installation, now the user have (if they had corresponding privileges) a right mouse click: Show effective permissions on a item, also it is possible to check this forlist or libraries (again, if the user have the privileges).
Sorry, I do not remember the number/name of the fix/update.
May be, that this link will help:
http://office.microsoft.com/en-us/windows-sharepoint-services-help/check-permissions-for-a-user-or-group-HA010362860.aspx
Kind regards
Michael
got it:
Microsoft SharePoint Administration Toolkit
Hi Alexander,
I have a Content Editor Web Part with a number of (the basic setup is a grid) containing name and title of employees in my Company. I would like to use tooltip/mouseover to preview a picture of the person. All images are stored in a separate Picture gallery on the same site.
I have seen all your other tooltip articles, but I am struggling to customise them for my needs. Can you please help me with this request?
Thank you in advance!
Hi,
Have you looked at this one?
Alexander
Hi Alexander,
Yes I have, but if I understand the code correctly, the tooltip image is retrieved from the URL or the link. In other words, the “IMG” link from the Custom List is pointing to the .jpg and the tooltip allows to preview the image/link. This is great, but not what I need.
Have a look at the image below: http://i52.tinypic.com/b715ld.png When I hover on the red box (a with a unique ID), I want an image to be previewed from a Pictures repository within the same SharePoint site. The images names are named .jpg. This is different from the code you have suggested because the does not link directly to an image.
I am sure this is a “fairly” easy thing to do for you, but I am really not a Javascript expert…
Please let me know if you need any more details. Thank you again!
Hi,
Something like this:
Alexander
Hi Alexander,
Thank you so much for this. I have slightly modified the code to get the unique ID of the person
Row 3
Bob
Row 16
var imgName = $(elm).attr(‘id’);
Now I am stuck with the following problems:
1 – The image appears instantly. It appears that the fadeIn() function doesn’t work as expected, even if I change the value to “slow”
2 – The image is stuck in a position and does not follow the mouse (I have a seen a ‘moveToMousePos’ function you have developed, but I am not able to modify it for this exercise)
3 – I need a onMouseOut function to fade out the image
Thank you so much in advance. In the meantime, I have moved some money to your PayPal account to finance your wife’s flowers! 🙂
I guess you have disabled the HTML tags. For the update in Row 3 above, it should look like
[sourcecode language="html"]
<td class="myClass"><span onmouseover="imagePreview(this)">Bob</span></td>
</code>
Take 3:
It should look like
[sourcecode language="html"]
<td class="myClass"><span onmouseover="imagePreview(this)" id="bob">Bob</span></td>
</code>
Thanks again!
Hi Alexander, I have just realised that the code above doesn’t always open the “tooltip” but it tends to append the image to the bottom of the page. Every time the tooltip is supposed to open, an image is added to the list. Now I am left with a page that contains ~50 images at the bottom.
Any suggestions?
Hi,
Add an onmouseout to the span like this:
onmouseout=”($(‘#preview’).remove()”
Alexander
Hi,
Did you get it working? – and thank you for the donation.
Alexander
Hi Alexander, unfortunately no. I am still experiencing a few issues and the code doesn’t work as it should. It partially works on one of my websites, but not on SharePoint. Do you have an email address or similar where I can send you my code? Maybe you will be able to identify the problem…
Hello Alexander,
Do you have any solution for incoming emails to lists or document libraries? When someone sends an email to a list/ doc lib (from LN for example) the email is saved as *.eml and so the header and attachement are not included with the body..
I didn’t find any posts regarding this topic although this matter is spread..
Please let me know if you need further info.
Thank you in advance
Sorry, but I do not have anything to help you here.
Alexander
In my custom list, I have multiple entries with similar data, except one field.
When I create a new Item, I have to create new entry with the same data except one for each input.
I’ll take one simple example. I have entries like these
Europe English Sp2010
Europe Spanish Sp2010
Europe German Sp2010
Europe Italian Sp2010
Europe French Sp2010
Europe Portuguese Sp2010
As of now, I have to create multiple newt for inputting this information. I know about datasheet view but that is not the point.
Is it possible to have multiple input entries based on number of checkboxes I select.
Lets say, for new entry(Continent), I select Europe. In checkboxes I select all above languages and click ok. It should be able to create six new entries with different languages.
If I select Spanish and Portuguese only(from checkboxes), then it should create only two items with two lang.
South America Spanish Sp2010
South America Portuguese SP2010
Thanks for your time.
Hi,
I’m very sorry to have delayed this answer so long. This is possible to make, but it might not be of public interest. I could do it for you, but it would be a custom job for you. If you send me some sketches of what you want I can make an assessment of the time necessary to make it.
Alexander
Alexander, a client has complained about the fact that when you change months in a SharePoint calendar (or do anything?), it generates a page refresh.
I’m wondering whether jQuery ajax would be a solution for that?
Thanks,
Michael
Hi,
It is nothing to be done about that as the refresh is necessary to get information from the server. The calendar acts like a paged list view – only the items visible are loaded, and if you want another set of items you must send a new request to the server.
Alexander
Good Day A, I am working on a solution to dynamically load a list view from one of many lists. I have about 40 individual lists. I want to create a simple table of contents with links to a data sheet view for each list. when I click the link I want to load it in the same page like an iframe. I dont want to use an iframe because of all the sharepoint page elements loading in the frame. is there a way to load a editable view of a list from a link of dropdown?
Hi,
I do not think this is possible without an iframe. You could however trim away the “access” when loading the iframe by doing a jQuery “find and hide” exercise.
Let me know if you need any help.
Alexander
Are you saying when I load the page I could hide the elements that load in the iframe? Which out going thru all the elements how couold I address this? also if this is 2010, could I take advantage of the modal window with less effort?
Hi,
Try something like this:
Alexander
you rock! thanx!
Hey A,
one more question on this. If I had multiple pages I wanted to load, individually, I want probably want a more generic function, right? what changes would I need to make to the loadlistview so I can pass differnt url’s based on the link?
would this work for the function?
and a link like this?
[sourcecode]
<a href="javascript: loadListView(‘/test/English/Lists/ECBCopyItem/AllItems.aspx’ ,’customListView’ ,800,600);">link name</a>
I did get the function to load correctly, with a few minor tweaks to what I posted, buty I lost the hide functionality. I cant figure out how to pass the ID from the link. I am also going to try it in a modal. any help with the hiding would be appreciated.
thanx
To have a menu to select list from, do it like this:
Alexander
Good day. You have so much to go through here. I am using sp2010. I have a list with a sum and a few calc columns. when the “Sum=” loads at the top of the page I want to remove “Sum=” and I want to align the value right. looks like sp aligns left, for currency this does not work. Also Do you know details about sum? meaning if there are negative numbers are they subtracted from the total? also if sum is a negative number can a color “red” be applied?
one last question. is there a way to sum a calculated column?
hey Tim, this should give you what you want. I got it from A many moons ago. I left the comments in to help you. This script replaces Sum with Total, but you can leave it blank. You should also be able to apply color. Sum CC’s i know I read a blog long time ago, but it was not perfected. Maybe A can shed some light.
[sourcecode]
<script type="text/javascript" src="../../Scripts/jquery-latest.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//var aggrText = $(‘TBODY#aggr > tr > td > table > tbody > tr > td > nobr > b’);
//alert(aggrText.text());
//alert(aggrText.html());
var aggrHTML = $(‘TBODY#aggr > tr > td > table > tbody > tr > td > nobr > b’);
var aggrText = aggrHTML.text();
var newText = "Total" + aggrText.substring(3);
aggrHTML.html(newText);
// know what Total you want
//var myTotal = whatever;
//aggrText.html(myTotal);
// Whatever your text is, that will replace everything inside the <b> tags
//var newText = "Test";
//aggrText.html(newText);
</script>
Tim, the above code is missing the closing
});
on line 19
if you add this it should work in MOSS and 3.0. I have been trying to get it to work in 2010 but not successful
Hi Alexander,
The question I got would be a modification of one of your cool scripts. I would like to show certain fields on a list item only to the creator of the list item. Is it possible?
Tony, I know it maybe be a little extra work on your part, but if you use this script:
https://spjsblog.com/2009/09/20/showing-or-hiding-list-fields-based-on-membership-in-a-sharepoint-group/
it will achieve your requested results
of course it requires you to create a group and add the editor to it, but it will work.
Hi,
Something like this:
Note: this example is tested in SP2007 only, if you use SP2010 it might need a little tweak.
Alexander
I have a search results web part (SP2007) that returns a list of web sites that the user is able to access. Can you offer any tips/code/references for using javascript reformat the list and group by URL into a heirarchy?
Hi,
Sorry, but this is impossible to do without access to that specific page.
Alexander
Hi Alex,
I had a site collection with sub-sites underneath it. All sub-sites including Main site collection have a Document Library called “Project Documents”. I need to show up the tree view with sub-sites and only “Project Documents” Library on the Main Page Quick launch Navigation of Site Collection. So user can go directly to that library from default site collection page. I had write this code and i can only get Main site collection Project Document library but not the sub-sites Project Document Library. I am not a Jquery expert i need some help to complete this code.
I had this jQuery :
$(document).ready(function()
{
// hide all of the tree view elements that are not related to the ‘Project Documents’
$(“div.quicklaunch-treeview > div > table”).each(function() {
if( $(this).find(“td.ms-navitem > a:not(:contains(‘Project Documents’))”).is(“a”) ) {
$(this).css(“display”,”none”)
}
});
// change the value of the site hierarchy heading to ‘Explorer’
$(“a.quicklaunch-sitehierarchy”).html(“Explorer”);
});
Regards,
Andy
The environment is SP 2007
Hi,
I looked at this, but with multiple levels in the hierarchy it becomes a bit messy – another thing is that this code must be placed in all pages that displays this tree view to work. I recommend you to make some kind of custom menu, but here is something i threw together as a starting point if you want to go the tree view route:
The function “TreeView_PopulateNode” is SharePoint’s own.
Alexander
Hi I would love to be able to add a button after the ok or cancel button in the ms tool bar is there a way?
Is it possile to add a button before the ok button or before the cancel button?
sorry let me explain further instead of putting out one line staements (gesss I am rude :-)). I know how to hide a button on the ms-toolbar (thanks to you) but the request is now how add another button there, after the cancel or before the cancel button?
Hi,
I have answered this question previously
Alexander
Hi Alexander, I am trying to make your “Tabs for Sharepoint Forms”, your “Headings for Sharepoint Forms” and your “SharePoint form: present fields side-by-side” solutions work together, but so far I haven’t been successful.
If these three worked together I could have total control of the forms page display. Is it possible to make them work together?
Hi,
These are tricky to get to play together (it’s the “side by side” that is the problem) – I would not recommend it, sorry.
Alexander
InLineEditing Request:
Hello Alenxander,
I’d like to request a version of the InLineEditing script that allows a person field to be a multi select field.
thanks!
Hi,
I have made a not of your request and will see what I can do.
Alexander
Hi Alexander,
Thanks for this site, I consider it the #1 End User SP resource on the web.
I’d like to request a tool / script which could pull the summed total of a column within a list view, then render that value as part of a text string elsewhere on the SP.
For example if I had a tasks list, and a list-view which filtered the tasks for “open”, with a numeric column – “number of hours” which totaled X. I would like to be able to have a text string on another page, which read “There are X hours of Open Tasks”, etc.
I have looked at JavaScript solutions such as OWSAPI with a view to coding it myself (badly), though wondered if any of your, more user-friendly/ergonomic, scripts such as the “vLookup type rollup” or the code behind your “Google Chart API” could be adjusted for this purpose?
Best Regards,
Tom
Hi,
Thank you!
Here is a code example for you:
You must go here and fetch the latest version of spjs-utility.js and change the script “src” in the top of the code, and you must edit the “argObj” match your column names and values for “filterField”, “filterValue” and “totalColumn”.
Alexander
Amazing, thanks Alexander, a Christmas donation is called for!
I’ve tested your solution and, as per usual, it worked perfectly.
Unfortunately I’m going to be a pest and add a criteria – can I specify a listview as part of the “argObj”?
The reason I ask is I’d like to use a specific listview to filter the items by [ME], and all items with a due date in the current quarter, I know how to setup the list views, though not how to reference said view in your code, or adjust the code to achieve the same aims.
Thanks again,
Tom
Just as a quick update to the above request: I have been able to add a field to my list and use your original code to filter according to today’s “year-quarter” (e.g. ‘2011-Q4’). I have also used your getUserInfo to retrieve the active user, though am stuck at this next step:
Can the code you provided be modified to filter **2** separate fields before pulling the total, specifically:
“YearColumn” = today’s year-quarter <- **complete**
&
"Created by" = user <- **stuck**
Thanks Again,
Tom
Hi,
Thank you for the donation!
Here is an updated code example:
Alexander
Works a treat, unsurprisingly; thanks Alexander!
Hi,
I am stuck with a document library form validation issue. I just want to check my document name for white spaces and block the item from saving to the library.
I am able to do this to a List Library using the below code
———————————————————-
function PreSaveAction()
{
var attachment;
var filename=””;
var sp=””;
var file=””;
var filenamewhitespace = new RegExp(‘\s’, ‘g’);
try {
attachment = document.getElementById(“idAttachmentsTable”).getElementsByTagName(“span”)[0].firstChild;
filename = attachment.data;
sp = filename.split(‘\’);
file = sp[sp.length-1];
}
catch (e) {
}
if (filenamewhitespace.test(file)) {
alert(“Please remove white space from the file attachment name.”);
return false;
}
else {
return true;
}
}
———————————————
But am not able to do this with a document library, as I dont know how to get the document name to the variable. What should I use instead of — “idAttachmentsTable” —
Can anybody help?
BR
Hi,
I do not think you can make this work for a document library as the “NewForm” does not exist. If you upload a document, you end up in EditForm directly – and the document is “in” before you can validate the name.
Alexander
Hi again Alex:
I need to display List items in a modified Box view style in which field names and the data are stacked in 3-4 columns across the page, and 3-4 rows down.
Example:
Col 1 Col 2 Col 3 Col 4
Row 1 field1 field3 field4
Row 2 field2
Row 3 field5
Row 4
The point here is that the code allow for the placement of fields in a List View in an XY grid. I am just assuming that the Box view is the closest.
Possible?
Charlie Epes
If the box view is not quite there, I believe modifying it will be hard and messy. I’m not quite sure what you want to achieve so if you could send me some sketches I might be able to help.
Alexander
Hi Alex:
On 2nd thought, I think this might be better done in a DVWP.
Thanks
Charlie
Good day A, Have a question. Is there an easy way to add to the SP 2010 ribbon an approve all button. I hate having to select each item and manually approve each one. I have found some script but they are deployed on central admin. I would like to a void that.
thanks
Hi Larry,
Thank you for the “beer”!
I’ll look at it and see what i can do.
Alexander
You rock, as always! enjoy the beer.
Hi Alex:
Is there a way to make the Inline Edit icon visible all the time, instead of on mouseover?
Thanks-
Charlie Epes
Hi,
Add this code to a CEWP in the view where you want the image to be visible:
Alexander
Hi Alex,
Shot in the dark here:
You don’t know a way of pulling the current list view name (other than using the URL), and representing it as text in a CEWP above said list, do you?
I have replaced the view selector with a Superfish Dropdown (thank you btw!) to make it more idiot-proof for my end-users. Though I’d like to add a “View: ” titile bar, to make it even easier to navigate.
Reason I’m trying – perhaps foolishly – to avoid pulling the name from the URL is because the names will have complex characters, and I don’t want to litter the URL with “%20″s, etc.
Any thoughts would be appreciated.
Thanks as ever,
Tom
Hi,
This is possible, but I need to know if you are on SP2007 or SP2010.
You could also unescape the “URL-name” to get rid of the %20’s
Alexander
Hi Alexander,
Apologies for not specifying – Sharepoint 2007 is the environment I am using in this instance.
Any thoughts are greatly appreciated.
Thanks,
Tom
Hi,
Sorry for the late reply, but here you go:
Alexander
Thanks Alex! & sorry for the slow reply!
I’m quite amazed that nothing seems to stump you.
Is there anyway to doucment.write() this list view name after the script?
I would like to format the view name as a title in a CEWP above the list. My initial attempt to use – document.write(view) failed miserably.
Best Regards,
Tom
Ignore me, solved it myself (a remarkable achievement given my level of ignorance):
Replaced:
With:
Then added:
Where I wanted the view name to be listed. Works like a charm, Thanks Alex.
hi, I am very big fan of you.
I have a request for you. I want to redirect to custom page once user click on save from newform.aspx.but it redirect to allitems.aspx.If i write redirect code in Presave action before “true” it redirect but does not save the data.
roshan,
check out these post Alexander has posted before: https://spjsblog.com/?s=Redirect+on+NewForm+and+EditForm+another+method
Thanks Larry,
Alexander
Thanks a lot Larry and Alex.
Hello,
I am using a group by in a list on sharepoint 2007 and per default that list is collapsed. What piece of code do I add to a CEWP that would open only the top node in the list?
thanks!
Michel.
Like this:
This requires jQuery to be loaded.
Alexander
Alexander,
Can any of your existing solutions be used to display a calculated column in the EditForm.aspx? Is that something that can be done with JavaScript or jQuery?
Thanks for everything you do for this community!
I should have said more. I would like to display the results of a calculated column in a read only mode in the EditForm.aspx. It would be fine to display the stored value in that field from the saved item version… its doesn’t necessarily have to be dynamic.
I tried using your field properties dashboard script (Cross-Site Lookup Column?) but that didn’t work for me.
Hi,
Like this:
You must change the four topmost variables – and you must refer “spjs-utility.js”
Alexander
Alexander, thanks so much, I didn’t realize you posted a solution! I tried it and found that it has the same issue that I’ve experienced when combining your scripts with the Tabs for Sharepoint Forms solution. Whenever the script has a prepend or append function, the script results apprear on every tab. Do you know how that can be fixed?
Hi,
What you have to do is to add the newly created <TR> to the “fields object” – try something like this (add this code after the code provided in the above comment):
Now you can use the name “MyCustomName” as any other FieldInternalName in the tabs constructor.
Alexander
Hey Alexander,
Can you create a java script that makes a standard column into a Unique value column in 2007? Apparently 2010 has the ability to create a unique value column ootb.
Hi Jay, take a look at this solution of Alex’s:
https://spjsblog.com/2009/11/23/sharepoint-lists-or-document-librarys-primary-key-in-selected-field/
Just one of the many incredibly useful solutions he’s posted over the years.
Regards,
Isaac
Thanks so much for this Isaac, I had not seen it. It is just what i needed. 🙂
Alexander,
Using SP2010, I have a need to be able to “schedule” banner images to show on a page. Similar to an Announcements schedule, but with images only. I envision having a list with the image URL and start/stop dates to pull from. Any ideas?
I guess you could use a custom list with an image field – and have a start and end date to filter the view by? Then you add this list – with only the image field visible to your page.
Alexander
Hi Alexander,
a colleague of mine came up with a request for a sharepoint list today. He’s tired of using an excel spreadsheet for email distribution lists and wanted a sharepoint solution from me that’s ‘three year old’ safe. Importing contacts from e.g. Outlook is not an option (since we don’t use Outlook). My first idea was that it should be pretty simple, just set up a list, define “to”, “cc”, “bcc” fields, a “name” and “subject” field and put it all together with a calculated field to generate a “mailto:” clickable field within a list (preferably using the distribution list name as the identifier).
So far so good but of course having only 255 characters for a single line field is not enough (and it’s not really usable to enter/edit data), having several of them not an option. So I altered my idea to have “to”, “cc” and “bcc” fields as plain text multiline fields but surprise surprise, those can not be used in a calculated field.
So I’m back to start and after spending some two hours with google rather clueless on how to set up such a list. Most of the search results refer to importing lists from Outlook, AD or another source which is not possible here. I’ve had a look at your solution to combine several single line fields into one multiline field but that didn’t help either.
Can you think of a solution to have multiline edit fields for the names that can be concatenated to use a calculated “mailto” clickable link?
Chris
Hello Alexander,
I would like to get to the add attachments box for an item in a list without clicking “edit” first, followed by “attach file”. I have learned that in the editform.aspx, the attachment box is hidden per default. Is there a way to open the editform.aspx and show the attachment box without that extra click?
I am using your “inline editing script” and also your “mouseover paperclip” script to view attachments in a list view. Now the last part to turn my page into a truly friendly UI is to be able to add an attachment to a list item directly from the list view.
thanks for considering my request !
Michel.
I am using SharePoint 2007
I’ll put this one on the list of things to do. I do have a few other script updates for some of my existing solution to attend to before I can look at it, but stay tuned.
Alexander
I subscribe at Michels request, great idea,also for 2010.. Also if we can get a solution for attachments history without storing them in a separate document library. 😉
If I can do more instead of subscribuing here…let me test it
Regards
Michael
Back again, now using WordPress account:
I am looking for an idea how to copy a list item into a new item (preferred) at the same list. In other words:
Select ID x by mouse (left/right), choose copy item, select a list (out of this site collection), click to copy, done…ID yy is created with all fields like ID x (dont take care for last modified, user,… only interested to copy the metadata belonging to the item itself)
Root cause for this is that when using list a history with versions did not a correct versioning for attachments from the list item
Thanks, Alex.
Warmest regards
Michael
It’s no problem to copy a list item by adding an entry to the ECB menu (the dropdown on the tilte field), but it’s not possible to copy the attachment in this process.
Alexander
Michael Again 🙂 Long night today:)
I know that this unusable to copy the attachment, but to copy the list item into a new one, adding with the next step a new(er) version of the same attachment (as used before) and set it to “valid” by a common checkbox in the list. The source list item also then will be set to “invalid” and greyed (filtered) out from the list.
Also this allow me to work with the brandnew offline client we decided to use (and is not so much confusing as storing the attachments in a separat doclib)
Regards
Michael
One more explanation why we can not add the new attachment to the same item: We need to show which attachment version (usually containing some rules) was valid at which time window. New version of rules = new version of attachment = new valid entry and one new “invalid” (the older one) entry. And copying the items avoid typing of repetitive metadata stories 🙂
Hi Alex, is it possible to us this with a little bit scripting to put this in the ECB you mentioned.
http://stackoverflow.com/questions/1075323/copy-list-items-from-one-list-to-another-in-sharepoint
rgds Michael
No,
That code example is server side code. I’ll add this to the “to-do-list”, but I have little time to spare for the time being so I cannot say when I’ll get the time to post it.
Alexander
Add WorkPhone to getUserObj_v2. I tested it and it worked fine on a MOSS 2007 box.
Work phone is not part of WSS3.0 and therefore I have not added it. You can however add as many fields as you like to the array of fields in the function.
Alexander
Can this be updatred? -> https://spjsblog.com/2009/10/29/add-html-mouseover-tooltip
Love your work, Thanks!
I have developed a jquery based TermsHighlighter. is it possible to place this on your site? See Codeplex: http://glossaryhighlighter.codeplex.com/
Your code is something that I may be able to use elsewhere but not for this and the reasons are Alexander has offered to fix his and I have already created the custom list will all my entries for it.
I am however on time constraints and depending on how quickly he has a new version dictates what I will be doing.
Lastly, your page isn’t complete as I cannot see all the coding….
Alexander,
First, MAD PROPS to your crazy good skills! Secondly, I need to create a compact news previewer exactly like this: http://tympanus.net/codrops/2010/10/03/compact-news-previewer/, but the input needs to be from a BLOG. I’d like the preview to show the top 5 approved and published news articles (blog posts), for instance, and display the Rollup Image, Title and Excerpt. Ideally, I’d also like it to auto-cycle through each of the 5 displayed, at whatever interval I set. I see many, many uses for something like this, whether it be from a blog, list, asset library, or whatever. PLEASE HELP!! Oh guru of the jQuery world, I bow to your knowledge and direction! And for a solution, a couple rounds of beers on me! I look forward to hearing from you.
Hi,
Sorry, but I do not have time to take on new projects right now.
Take a look at this one and see if you can adapt it to your need
Alexander
Alexander,
I have a request that involves the People Picker in SharePoint 2007. The OOTB solution only allows us to choose “People only or People & Groups”. Is there a way to have it only allow for “Groups only”?
Thank you for all that you do!
Oh, another thing. Would it be possible to limit the amount of groups that can be selected per field? I am already using your spjs-utility to validate the data in 2 pickers to verify that they both don’t contain the same single group…
Hi,
Sorry, but i do not have capacity at the moment to take on new development. I have a few scripts in this blog that addresses people pickers. Look at them and see if you can use bits of the code.
Alexander
Hey Alexander and others,
I hope I am not double-posting here, but my request has to do with the excellent scripting done already on “Preview Metadata” in regards to a Sharepoint 2007 site. I have a list view that i am using this with and it works great. What I would like to do however is rather than use the Jquery hover event to bring up the popup, I would like to make the popup a “dialogue” event that is activated on a click and dismissed with a click. So it is a new request, but based on an old and awesome script. What do you think?
Answered here
Hi Alexander,
I’m trying to send an email to a list of email addresses using the Server’s default outgoing email as the sender. The email addresses are in one single column.
Basically the list is a “Enter Your Email to Subscribe” list and when a new announcement of feature is added, I can then send an email to all email addresses in the list.
I don’t have User Profile Sync set up, so I can’t use the email address from User Profiles.
I’ve found this: http://social.msdn.microsoft.com/Forums/en-HK/sharepoint2010general/thread/0a760ab8-dfad-4880-acb4-15a7a0055283 where the person at the bottom explains how to do it using Javascript but doesn’t provide the actual code. 🙁
If you can find some time to provide a script, I’ll send a few beers your way?
Hi,
Sorry for the late reply.
Did you find a solution to this problem, or would you like me to take a look?
Alexander
Hi Alexander,
I haven’t found a solution for this other than physically adding a user to a SharePoint group and using a workflow.
If you get time and if it can be done, that would be great, no hurry.
,
Brett
Hey A, it’s been a while. I hope you are well. I amnot really sure what I need, but anm hoping you can point me in a direction. I want to get a facebook rss feed to display in sharepoint. I tried using the default rss reader, but I get an error for facebook. do you know how this can be done or a work around?
Larry
Hi Larry, I’m afraid I cannot help you with this. I’m not on Facebook so i have no knowledge about their RSS feed. Alexander
Hi Larry did you want a feed for a particular profile :
this is how you do http://www.facebook.com/feeds/page.php?format=atom10&id=xxxxxxxxxx you need to find a profile id and replace with “XXXXXXX”. Also you can see it in firefox and ie but not from chrome this atom.
Hope this help.
Hi Alexander,
I have a request – I have apx 250 managers who all need to faciliate a meeting where they collect different data on employees. I’ve made a summary sheet in Excel for them.
But I would love for them to be able upload the data directly to SharePoint, so all the data is collected in one huge list for me to dissect and summarize. From what I’ve red in forums the import function is lacking in SharePoint 2007 (and 2010).
The alternative to the solution above is they all upload their file to a library, for me to do all the work in Excel and the c/p into SharePoint… 🙁
Really hope you would consider to provide a solution to this common SharePoint problem, which it seems to be. 🙂
Thanks for all your great blogs.
Hi Alexander, I’m loving your double booking resource check script but was wondering … I’d like to use it to manage our training rooms of which they are circa 80. Short of the scheduling staff trying several times to find a free room I was wondering whether there is any additional script that would show the availability of rooms. That way the team can look and see what isn’t booked and go ahead. If by that point someone else has booked the room, your current script will stop the double booking.
Not to worry if not I’m just keen to move away from a massive colour coded spreadsheet :/
Dear Alexander,
We’d like to add a dotted line to the solid line graph where dotted would represent forecast while solid are actuals. Any suggestion on how this can be done? We’re still on API 2.7 SP Control Update.
thanks
Clare
Hi,
I’ll post an updated version of SPJS Charts for SharePoint within a few days. This version supports alternative “column roles” as described here
Alexander
Hello,
I read through most of your posts Alex. You have some great Javascripts. I have a couple of questions, if you can please help me answer them would be great.
1. I need to attach Javascript to a custom EditForm for a content type, so I did it the traditional way, i.e. attach Javascript to the CEWP. But everytime I create a template of the document library when this form is residing, it drops the CEWP. My question is that you mentioned that Javascript can be attached inline, i.e. can we reference it in the custom EditForm.aspx code somehow? Please note that the Javascript is working great on the current document library. Also, when we create the template, the custom EditForm is getting copied over, it is just dropping the CEWP. Please advice.
2.For the OOTB Calendar, I have added it on a page using webpart. Now, I wish to make some changes to it. For instance, change the days of the week to display 3 letter acronymn, and not just a single letter. Also move the prev/next images. I wrote a Javascript to scan the HTML and am trying to replace Sunday, would this work?
Again thanks much for all your help.
Hi Alex:
Just like your fantastic “First/Today/Last” date picker solution does, is it possible to add a “Today” clicker on top of a Single line of text or Multiple lines of text so that an entry can have today’s date + semicolon + a space? I know that versioning will do this but I need users to have freedom to edit. Thanks- Charlie Epes
Where may I see a demo or actual implementation of Dynamic Forms/Tabs?? Thank you, Tom
Is it possible with jQuery etc. to do custom coloring of calendar events?? Thank you, Tom
Hi Tom, check out the solution from Path To SharePoint: http://usermanagedsolutions.com/SharePoint-User-Toolkit/Pages/Color-Coding-Calendar-List.aspx
Hope this helps,
Isaac
Hello Alexander,
Thank you for the great tips and codes you provide regularly here!!!
I’m using SharePoint Online (O365), and I have lists and libraries with huge amount of views. I would like to organize the views (they’re just presented today in alphabetical order) in the list or library views dropdown. I’d like to have a menu/submenu presentation with specific labels for the grouping of elements. Could you help?
Thanks a lot (even if you can’t ^^).
Hey A, Hope you are well. quick question. Is there a way to disable all links on a calendar. I have a publishing site, which in itself is a nightmare. I want to display the calendar, but i dont want the user clicking any links because they will be authenticated. if I disable the links that will giove them results. I have tried several methods
[sourcecode 1=”$("td.ms-cal-topday” 2=”div” 3=”a").attr("href","javascript:void(0);")” 4=”[/sourcecode” language=”}”]
[sourcecode}
$("td.ms-cal-topday div a").removeAttr("href")
I an see the attribute removed, but the link still works.
thanks Larry
lost the source code
[sourcecode]
$("td.ms-cal-topday div a").attr("href","javascript:void(0);")
[sourcecode]
$("td.ms-cal-topday div a").removeAttr("href");
Try removing the onclick attribute.
Alexander
Thanks A, you rock. It took a bit for me to figure it out, but works perfectly.
Hello Alexander,
I while ago your posted a solution to hide the “Sum=” prefix from the Total columns.
I’ve placed your code in a CWP that’s below the list but nothing happens. The list is placed on a sitepage with a graph webpart.
What can be the problem?
Thanks in advance,
Jimmy
IE Dev Tools can be your friend. Sometimes I have similar issues. This tool help you to identiy the correct elements. Once identified you can update your script or css.
what version of SP or you trying this on?
Hi Larry,
You’re right, i’ve managed to solve the problem. In my case if was the translation to Dutch that did the trick.
Thanks for your reply.
Hey A,
I have searched for this now over several days and i cannot find a solution. Not that I want you to build one, I just want to know if it is possible. I want to display a 2 month calender view. I am ok with added to separate calendar web parts, I just want the second one to always display next month.
Using list view this is easy to accomplish, but I cannot figure out a solution for a calendar view.
any suggestions?
thanks
Thanks Alexander for your contribution. This was relatively easy to implement even for a beginner like me.
I was wondering if you could post an example of a chart using the select event ‘getSelection()’ to link a portion of the chart back to a subset / filtered data in the SharePoint list?
Thanks.
Is there a solution to pull in the names of selected people as part of a “people or group” field into another field vertically stacked? I’ve tried using a calculated field but the “people or group” field type doesnt seem to be supported. Any help would be greatly appreciated. Thanks.
Infamous fields-side-by side…
Has anyone overcome the issue of mulitple fields in one ? Changing the positioning of the script above or below the get/set field script does change the behavior, but does not get it to work.
Last comment on it a year or so ago was basically ‘don’t try it’. Perhaps there is an alternative way to get the same look?
Brian
…in one [table row]?
Hi Alexander, hope you are doing well. I am still enjoying your solutions on our internal pages.
But today, I want to ask for new solution (or a link to a similiar solution).
How to add TABS to sharepoint pages which uses individual links (url from www, another view of the same list, jumping to a doclib, home button,…..), shown on top of page, must not be part of the ribbon (because this did not appear easily after adding webparts)
Searching around I can only find your tabs for fields or the easy tab solution, but no solutions which add the tabs with jquery and take the links from a list or out of the code…
A list (an ID out of a list) looks preferrable, because it can reused at several locations to provide links.
Any Ideas or Hints?
Kind regards
Michael
Alexander,
Like everyone I find your scripts extremely useful and i thank you for them. I have what i hope is a simple question: using the truncatetextinlistview Is there a way to dictate how wide the popup is going to be? i basically need it to appear to the left of the mouse button instead of the right and use most of the page…
v/r
Rob
Hey again A, Hope you are well. I am looking for a quick solution and have been unsuccessful. I have a web part page. The page I am using has the header and footer with 3 columns. I am trying to set/force a width, at least to the outside columns and have the middle one take up the rest. I know if I fumble with it enough I can make it work on that one page. but I am looking to create a way that no matter which page I drop it on, maybe all I need to do is define the column widths. several of the styles I have tried have failed. setting the width of the web part failed. I still have this white space I cant get rid of. so I think my issue is I am not targeting the correct element. can you shed any light on this?
Hi Larry,
We discussed this by email, but I wanted to put the answer here for others to see.
Alexander
good day, I am seeking a way to disable or remove links from a calendar view on SP 2010. when I view the source I do not see any anchors or hrefs. How are the links created, and can they be removed or disabled?
Sam,
I took a look at this and I was kind of befuddled. I did identify that the days are on a clickable div and I was able to disable them, but if I navigated to another month I lost that function. I also noticed that the events appear to be place on the calendar using a content area. I was not able to see the details in the source code. you can look at what I have it might help you along. Perhaps A can solve this better for you.
Hi,
Is it the “title” linking to the item you want to remove? If so, try this code:
This code fires every 500ms and replaces all anchor tags with their text value.
Edit: the code disappeared.
Alexander
Read more here: https://spjsblog.com/2013/08/02/remove-click-events-and-disable-anchor-tags-in-a-sp2010-calendar-view/
Alexander
Would the resize multi line text field javascript work in conjunction with the Dynamic Forms script? Or is it possible to institute that feature within the dynamic forms script.
Thanks…
Good day, I am inquiring if there is a way to sort attachments. I understand the are added into a table, or row. Can jquery have the ability to sort them? and if they can be sorted can they be sort by user selected order?
thanks
hey A,
You know I love your site, blog, posts. It is great that you utilize sharepoint beyond its intended purpose. I have been trying to create a solution that combines several different functionalities, not necessarily from your scripts, but willing to bet you can do this. I am looking to create a text animation. I have read that the marquee is coming back with css3. I have also found that jquery can do some simple animation with the marquee, but I am looking to take it a step or two further.
I want to use a list. I want to control the number of loops. I want to step thru each item on the list and when I pull an item I want the ability to display it on multiple lines
example:
Your
guide to
SharePoint
I would also like the ability to control the speed of each line.
I have seen your text scroller, So I know most of this can be accomplished. the tougher stuff like multiple lines and speed for each line, much tougher. I am not sure if maybe the source list has several columns for each line or if it could be done with an array. I would be willing to pay for this solution. or maybe you can shoot me some ideas and I can try and hack it.
thanks Larry
Hi Larry,
I would need a mockup / sketch to see clearer what you are after.
Alexander
I have emailed this cause the code didn’t come thru. One last thing I did nto mention is for each “LI” the $(“#welcome”).animateText([]} will need to be built, which I am thinking is easy compared to the rest.
let me know if I have asked for too much
Hi Alex:
I hope you had a good summer!
I am trying to freeze list view column headers so the headers stay on the page as the user scrolls down the list.
There are many solutions posted on the web but none seem to work on a list view. They work on a master page.
Do you have a simple solution?
Thanks as always.
Charlie Epes
Buffalo, NY
Hi,
I have tried to do this earlier, but did not find a good cross browse solution so I’m afraid I do not have a simple solution to this. If I remember correctly, I did set the “tr” to position:absolute, and had a script correct for the scroll, but it worked for IE only.
Alexander
Hi,
First of all Thanks for your contribution and support. I have a project in which i need to copy data from one list on one site to another list on another site. The Data stored in list1 is dynamic and hence should be moved to another site at regular intervals(Every 30 secs).List1 contains colums like issues , assignedto, and status and list 2 contains columns with assignedto and status but list 2 will give a count of how many issues are assigned to associates.
something like this
List1
Issues Assignedto Status
Issue1 cari Assigned
Issue2 Terri New
Issue3 cari Assigned
Issue4 Teri Assigned
List 2 should contain
Assignedto Status Count
cari Assigned 2
Terri Assigned 1
Terri New1
Chalenges are
1)These 2 list are on different sites (Reason being the client does not want to touch the original list)
2)Getting data accross sites
3)the List1 data has to be synchronized with list 2 to every second(data has to be refereshed with few sec)
4) the count calculation has to be done before the data is between copying data from list1 and putting the count in list 2
Kindly help.
4)
Hey Alex, it’s been a while. I have a small request for you. I have been struggleing with this for over a day. I want to load a sp 2010 page and hide all navigation and quicklaunch, but I want to ability to show this if I am an admin or editor of the page. Now using these styles I can hide all I want;
but I cant not get it to display when I want to view it. I have tried switching stylesheets, but not effective for round trip. I have tried using just jquery, but toggle doesnt leave me the desired effect I am looking for. and ultimately I would like to have a cookie so it remembers my choice.
can you help with this?
thanx
Larry
Whew, ok, I have a some what working solution, missing the cookie.
here are my styles
jquery: include jquery reference:
then I add to the page
besides a little formatting the toggle works. I need to default it to hide, and I wand to add cookies to remember, from page to page. con you help me with this?
thanks
larry
Sorry for the delay, but I have had a lot of emails to go trough.
Some of the code was removed. You must wrap it in
<code>
// Code here
</code>
Alexander
Thanx A, I was able to figure this out. I realized I only needed to set the cookie for the Admin, leave it blank other wise. IF anyone is interested in the code I can share it.
So again I have a new request. I am looking for a straight stick countdown timer. Basically days hours minutes and seconds. I need to be able to apply css to format each individually. I would also like a progress bar showing the relative remaining intervals. I already have a working solution for this, but I cannot get it to work in MOSS. I modified the example from here: http://keith-wood.name/countdown.html. I was able to modify this code to add custom style and a progress bar. it doesnt matter how I try to load the content on a SP page, no counter displays. I know it is in MOSS, can you help any? I can provide you my code if it helps.
thanks Larry
Hello my friend. I have a new request. The recent others I was finally able to resolve. This one is related to color coding a calendar. I have used Christohpe’s script for many years and push it to it’s limits. Onee thing I have noticed, that I cant find a solution for is the title attribut for the individual events. when you show a calculated column in a calendar view it uses that field for the title attribute. So HTML comes across. I want to know how, maybe with jquery, can I replace the title attribute with another field, or a concat of fields so it is just test. Maybe even replace the attribute value with the default Description field.
what do you think?
Thanx Larry
Hi,
I’m sorry, but I cannot help you with this one.
Alexander
Hi Alexander
I have just come across your blog and can see you have done some amazing work with customising SharePoint.
Would you know of a method for displaying a column that can display the difference between todays date and the date from column called due, so if it was Monday and the due date was Friday it would display 4days and if it was due last friday then it would display -3days. I would then like to have another column that shows a status colour so it would be green if the were more than 1 day difference, yellow if it was 1 day difference and red if it was into the minus days.
Happy to pay you for your help.
Hi,
Take a look at this one: https://spjsblog.com/2008/11/26/compare-duedate-with-today-in-list-view/
Alexander
Everyone loves what you guys are up too. This kind of clever work and exposure!
Keep up the fantastic works guys I’ve added you guys to my own blogroll.
Hi Alexander, It has been a while and I hope you are well. I am working on trying to figure out how to color code gantt bars in SP 2010. Have you worked with this, and can it be done?
thanks Larry
Hi,
I’m sorry, but I haven’t done anything with the GANTT charts.
Alexander