Skip to main content

WSS Demo

Go Search
WSS Demo
Blog
Wiki
SharePoint, MOSS & WSS Resource Links
Fantastic 40 Templates
MOSS End User Training
  
WSS Demo > SharePoint > Comments  

Web Part Page Title Bar image
Comments


Site By: Ian Morrish
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
Hosted By:
Intergen
 
Microsoft Windows SharePoint Services 3.0 (WSS) & MOSS Demo site by Ian Morrish

 Content Editor Web Part

Thank you for your feedback.

I'm not able to provide SharePoint product support so please don't ask me for urgent help.

I am open to suggestions on demos you would like to see on this site and comments on existing pages.

 

 Data Form Web Part

Your Name:
eMail:
Notes:
Page:

 Try me online...

 How this page works...

This is just a standard SharePoint Web Part Page. The Master Page for the site contains a hyperlink to this page so that users can comment on every page in the site.

Behind the scenes there is a sharepoint list with the fields that you see in the form on this page and I have signed up for alerts on this list.

The form is a Data Form which must be added to the page using SharePoint Designer. To add the form, insert the Data View from the the SPD Data View menu.

  1. Select the list that will hold the data from the data source list
  2. Select "View data"
  3. Hold down the <Ctrl> key and select all the field you want displayed in the form
  4. Select "Insert Selected Fields as", "New Item Form

SharePoint Data View New Item Form

You can add an action to the Submit button. Just right click the button and select "Form Actions". I have added a "Navigate To Page" function so that users don't end up at the default AllItems list view.

 

Data Form Actions

I populate the Page field on this form from the referring url buy using the following Java script added to the page. (the value in red is the name of the field I want to update).

<script language="javascript">
_spBodyOnLoadFunctionNames.push("fillDefaultValues");

function fillDefaultValues() {
  setFormFieldName("Page");
}

function setFormFieldName(fieldName) {
  var theInput = getTagFromIdentifierAndTitle("input","TextField",fieldName);
  var txtValue=document.getElementById(theInput.id);
  txtValue.value = document.referrer;

}
function getTagFromIdentifierAndTitle(tagName, identifier, title) {
  var len = identifier.length;
  var tags = document.getElementsByTagName(tagName);
  for (var i=0; i < tags.length; i++) {
    var tempString = tags[i].id;
    if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len)) {
     //tags[i].id.defaultValue = document.referrer;
      return tags[i];
    }
  }
  return null;
}
</script>

This script is derived from an awsome post on the SharePoint Designer team blog...
http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx

Comment on this page...