Share via


How Do I.... WebPart

So I had a need to create a How Do I... drop down.  This dropdown would be used to provide quick help for common tasks on a sharepoint site.  Well it would be very easy to use the "I need to" web part.  it allows for a custom list to be used to create a task list.  One problem though, it navigates directly to the page as opposed to opening a new window and the client really wants it to open in a new window. So what does one do, well after searching on the web.  I found a few articles that demonstrated how the portal.js file could be modified the only issue with that is, if the file gets updated say via a service pack.....  there go my changes.  The only way i could think of handling this was creating my own webpart... but this did not sit well with me as it felt like i was re-inventing the whell.  So I had another thought.

There is this fun webpart called the Content Editor Web Part aka CEWP.  it allows for rich text or direct editing of the html source.  With the direct editing of the html source I could then simply write in my own script.... to open the page....One problem though, the I Need To webpart specifies the javascript function via an anchor href attribute. I some how needed to modify this property.  Well back to CEWP.  i can change the href property of the anchor tag to point to my javascript file as the page loads.  And voila, I can now override the default of the I Need To webpart to open a new window as opposed to navigate to directly to the page.

The moral of the story here is CEWP can be your friend.  Using it can allow you to create client side customizations that aren't readily available without having to do some scary modifications to sharepoint!