A recent project tasked me with providing a default value for an enhanced rich text field. Most field types allow you to set a default value out of the box. With enhanced rich text (multi-line text field type) there’s no option to set a default value.
I decided jQuery was the route I wanted to go on this one. After Googling for a fair while I finally found a response that helped.
Modifying the answer provided there, I simplified the code that worked to:
Just save that code as a .js file you upload to your site. Then reference the saved .js filepath via a Content Editor Web Part placed on the new item page (newform.aspx).
Not familiar with jQuery?
The first line of the script needs to reference jQuery. In some environments this needs to be hosted in your site (I typically use Site Assets for this). In other cases, you can just reference it hosted elsewhere (not recommended, but could work for testing/short-term in some environments). I used the code from http://code.jquery.com/jquery-latest.min.js and saved its contents as a .js file of my own that I uploaded to Site Assets. Then just replace the URL in the first line of the script with the URL of the file you uploaded to Site Assets.
More than one enhanced rich text field?
The script looks for any enhanced rich text field, and in my case I only had one in the form so it was fine. If you have more than one, just replace TextField_inplacerte with the full ID of the rich text text field on your form.
Hint: User developer tools with F12 in the browser then select the field. The ID you want will end with TextField_inplacerte and likely start with your field name.
I recently received a request to create an education listing of courses where a user could “Register” easily for upcoming opportunities. This required creating two lists: one for courses and another for the registrations.
The most important part of this was that when a user clicked “Register Here” on a calendar item, it would take them to this separate registration form on a completely different list and auto-populate the Training lookup drop-down based on which “Register Here” link they clicked.
Courses list (calendar app)
The first list for courses, Courses, is a calendar app with the courses. It has two necessary columns you must add:
A calculated column called Training: =IF([End Time]>=NOW(),(TEXT([Start Time],”YYYY-MM-DD HH:MM AM/PM”)&” | “&Title),””)
A custom hyperlink-type field called Register Here. The value is set by a simple SharePoint Designer workflow.
The link is structured so that when clicked, it’ll take the user to the NewForm.aspx form for the registrations list (ContinuingEdRegistration). The user will enter their info there to register for the course.
For the workflow, I used a simple two-step 2010 platform workflow for the Courses list, set to trigger on creation OR change.
When setting the variable in the workflow:
Click the ellipses (three dots) to open “String builder”
Paste the normal link to the second list’s NewForm.aspx page (ContinuingEdRegistration in my example)
Add ?Training= to the end of it, replacing Training with whatever URL parameter you’re wanting to use to help in auto-populating a field
Click “Add or change lookup” to add Current Item –> ID
Add a comma and a space (will not work without space)
Enter link text, like Register Here
The second (and last) step is to set the hyperlink field we created (Register Here) to that variable from the first step. Publish the workflow.
You can set the calendar view to whatever works best – an actual calendar, a list, boxed, etc. as long as the registration link is available to users to click.
ContinuingEdRegistration list (Custom list app)
The ContinuingEdRegistration list and new form is simple:
A lookup column to our Training on the first list
A field for the user being registered
The key to this working is editing this ContinuingEdRegistration’s NewForm.aspx page seen above and adding the following script via a Script Editor web part or Content Editor web part. Thanks to Emiliano Poggi for sharing the script that inspired this solution.
function getUrlParameter( name )
name = name.replace(/[\/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ) return "";
else return results;
document.getElementById("Training_67194962-c685-4033-8744-701fd9f26beb_$LookupField").value = getUrlParameter("Training");
Be sure to update both the “ID” boxed below, as well as the URL parameter to look for (used in the SPD workflow between ? and =).
If you’re unfamiliar with getting element IDs using F12/developer tools, just go to the NewForm.aspx, hit F12, choose the “selector” probably a mouse as seen here and then left-click the element (dropdown) to get its ID. The following screenshot is using Chrome to find the ID (in blue following the # mark):
Once you’ve updated the script for your specific fields, you can either copy and paste it into a script editor web part or save the script as a .js file in a folder like Site Assets then reference it in a Content Editor web part like this:
Once you’ve pasted a link to the script in the content editor web part properties panel, click OK. Then you can stop editing/save the page to continue.
To test your solution, just modify or create a new calendar item. Here’s what should happen:
Your SPD workflow runs, setting the “Register Here” hyperlink field to the correct URL with that item’s unique ID included
Your user clicks that hyperlink on the calendar item and is taken to the Registration list’s NewForm.aspx page. Note that the URL should include ?Training=123 or something similar at the end- this is the URL parameter the script is looking for.
The script finds the URL parameter and dynamically updates the dropdown to the lookup choice that matches the ID.
The user completes the rest of the registration fields and saves/submits.
Taking it further
A further enhancement might be adding &source=CoursesListURL to the URL created in the workflow to redirect users to the calendar again after registering.
You can attach documents to SharePoint list items. However if you add the “Attachments” column to your list views, you get a column that only shows a paperclip icon (see below) if there are any attachments. Clicking that paperclip also won’t open any attachment or the list item to view them. It’s strictly an image.
Here’s how you can replace that paperclip on each row with the actual name(s) of your attachment(s) linked to the actual attachment(s).
On one of my recent projects, a client asked if it would be possible for the link to a task within a workflow notification email to open the task in “edit” mode instead of “display”. If you’re unfamiliar with SharePoint 2013 task processes built in SharePoint Designer, here’s what their process looked like prior to our change:
Someone submits form
Approval request sent to manager
Manager clicks link in email to open task
Manager clicks “Edit”
Manager clicks “Approve”
They wanted to eliminate step 4 to make the process as easy as possible (one-click after opening link in email). Here’s what we ended up doing:
The aspx page that holds the content of the pop-up
The script that loads the aspx page in a modal dialog upon page load
Save this .aspx page to your “Site Pages” directory.
Copy and paste the following into a new .aspx page in your Site Pages or Pages (Settings wheel –> Site Contents –> Site Pages or Pages) directory:
We will be performing routine maintenance on SharePoint Librarian Monday morning from 4 am – 5 am. There may be a brief disruption for users online during that time. The maintenance window is scheduled for 1 hour.
Modify the content in the aspx page beneath the modal-content div and above the input tag to include your own images, formatting and message text.
Update the script to include the URL of your newly saved aspx page and a title for the pop-up window (optional).
Add a content editor web part to the page on which you’d like the pop-up.
Add web part
Edit web part
Save page/stop editing
Below on the left are two traditional, out-of-the-box solutions for showing Today’s events in SharePoint. Notice how both take up a lot of extra space repeating today’s date (which we don’t need to see at all in a web part called “Today’s Events”) or showing gray space where there are no events. Soak that in – prime real estate on your home page goes to non-existent events. These also may require overlays and other manual labor processes that need adjusted every time a calendar is added or removed.
But on the right is what you could have. It uses search instead and displays events from all calendars a user has access to in one place. It shows only the necessary information on the home page and links to full details. And with a little CSS included in this post, it can look polished and themed. Imagine all you could do with that saved space on your home page…
I jokingly said at a recent presentation that I thought adding weather to our intranet’s home page was a good idea for employees like me who work in the basement and don’t see much of “the outside.” But it can also help with planning and decisions depending on your industry and daily routines.
Accuweather has a free script for a widget you can use that resizes perfectly on different screen sizes. I’m impressed with its simplicity and how dynamic it is.
All you need is a script editor where you’re placing the weather on your page and the following script from Accuweather.com. This script will work as-is from a straight copy and paste, but you should generate your own code from their website to paste after the closing style tag so that when clicked, users will be taken to more info specific to their location instead of mine. You can start from scratch on their site, just be sure to add the “style” tag and content below before the script they generate for you. This will get rid of a rather pesky button they include.
Your image slider is okay. But you’d like it better if it had a makeover (50 points to whoever can guess the commercial reference).
This post will show you how you can take your out-of-the-box content search web part slideshow from this:
This solution supports multi-line descriptions that don’t get cut off. It gets rid of that dreadful partially transparent overlay and gives you more of your photo uninhibited by messy design. It’s more modern, lighter and sure to impress. At the end, be sure to adjust the CSS to match your own color scheme and size needs.