holding a glowing earth globe in his hands

Creating a Knowledge Base Site – Part II

May 17, 2011
Comments off

Sorry for the delay in continuing the Knowledge base tutorial, I decided to take a well deserved long weekend and relax. Anyway I’m back on the job now and need to add the next part of this tutorial. I’m going to keep this one pretty short as I’m under time constraints today but I will be back on the ball tomorrow with a more detailed tutorial part.

So quick re-cap.

Creating a Knowledge Base Site – Part I dealt with adding a workflow to the document library in order to add a new section if the user requested one.

So by now you should be at the stage where if you upload a new document and add a new section then a workflow will run and complete the process of adding this new section to the Categories list and then update the item with the Category…….Sound about right? I hope so.

So from where we left off we are missing one very import thing, validation. What we want to do is set up the document Edit Item form page so that we can either select a Section from the list OR add a new section but not both.

We are going to add the validation to the page by modifying it in SharePoint Designer and adding JavaScript directly into the code, simples. So first things first, open your site in SharePoint Designer and location the EditForm.aspx file for your Document Library:

Assuming that you Document Library is called Documents then the file should be in the following location:

\\root\Documents\Forms\EditForm.aspx

Right click on the file and Check Out the document and then open it. Now follow the steps like so:

  1. Select the Split view so that you can see both code and the visual representation
  2. On the visual representation click on the List Form Webpart, this will highlight the code that corresponds to this
  3. Scroll the code until you’re at the bottom of the highlighted code.
  4. On the code, directly after the closing WebPartPages:WebPartZone bracket add a couple of blank spaces.
  5. Add the following JavaScript
    http://mickyjay.co.uk/resources/js/enableDisable.js
  6. Save the EditForm.aspx
  7. Return to the Document Library on the internet browser and upload a new document.

Essentially what this JavaScript, and I admit it is not the best code in the world but it does the job, is check to see whether a Section has been selected or not. If a section has been selected the the New Section field is disabled, if the Section field is set up to (None) then the New Section field is enabled.

I’m sorry its such a short post but hopefully that should give you something to play with until the next post. I’ll be back tomorrow with more advanced stuff I promise.

Comments are closed.