Tuesday, October 27, 2009

Remove Save button in Surveys with Branching

After a lot of searching and fiddling, i found a way to do this

Step 1: Go to the survey response page in SharePoint designer
Note: SharePoint designer is available for download at Microsoft for free
Click here to download
Step 2: Add a new row to the table in the page.
Step 3: Add a content editor web part by going to insert > sharepoint component > webpart > content query webpart
Step 4: Go to code view of content query web part and insert the following code between the CDATA []

Add a script tag and add this code along to it as shown in the image below


Code
_spBodyOnLoadFunctionNames.push("setValue");

function setValue() {
  hideButton("Save");
}

//This function hides a button on the page
function hideButton(valueDef){
  var frm = document.forms[0];
  for (i=0;i
    if (frm.elements[i].type == "button" && frm.elements[i].value == valueDef) {
    frm.elements[i].style.display = "none";
        }
    }
}

Note: If your survey uses more than 1 branching logic/you have more than 2 pages in the survey then you need to do the same for intermediate page

No comments:

Post a Comment