Skip Ribbon Commands
Skip to main content

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...

 
Add this Chat to your own site by following these instructions. You can either use the Content Editor and paste in the HTML using the source edit or use the Page View web part and use the href value as the page source as I have done.
 

 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