0

SharePoint 2007 Standard

I have a survey, which has been broken up with page breaks. Is there a way to add introductory content to each segment? As best as I can tell, there isn't a new ASPX page for each section, so a change to the basic form will show on all pages.

Any ideas appreciated.

1 Answer 1

1

You could achieve it by generating introductory content on the client side as demonstrated below.

Steps

1) Add CEWP into Survey Edit Form page

2) Insert the following content into CEWP

<h2 id="questionSummary">Please specify your development skills​​​</h2> 
<script type="text/javascript">
function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}


(function(){
   var questionSummary = $("#questionSummary");
   var fieldName = getParameterByName('FirstField');
   switch(fieldName){
       case "Skills":
          questionSummary.append("Please specify your development skills");
       break;
   }    


})();
</script>​

Key points:

  • during page navigation in Survey form, query string parameter FirstField is appended

  • function getParameterByName is used to retrieve query string parameter, in our case FirstField

Results

enter image description here

Note: The specified example is for SharePoint 2013 but the same approach could be applied in SharePoint 2007

3
  • Vadim, many thanks for this. Just to clarify in my own mind, I'm going to need to add additional switching statements for any new page that I want to generate introductory content for? And the parameter to use, as in the case="skills" is the one that appears in the URL after the "FirstField=" text? Commented Apr 23, 2014 at 9:33
  • 1
    Steven, that's correct. Commented Apr 23, 2014 at 9:51
  • I see how it works now. For the benefit of anyone else reading this the SharePoint 2007 GUI doesn't allow you to customise the EditPage.aspx in surveys. Or Team Sites don't at least. SharePoint 2010 / SharePoint 2013 allow you to edit the EditForm.aspx Commented Apr 23, 2014 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.