Sunday 29 July 2012

Hide Graphical Summary & Show all responses links in Survey

Following is the script to hide the Show a graphical summary of responses & Show all responses link in Survey overview page as shown in screenshot.



<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("hideanchor");
_spBodyOnLoadFunctionNames.push("changeiMageblank");
_spBodyOnLoadFunctionNames.push("changeiMageblank1");

function hideanchor()
{     
  var anchort= document.getElementById("diidSurveyResults");
  var anchort1= document.getElementById("diidResultsByUser");
  anchort.style.display = 'none';
  anchort1.style.display = 'none';   
}
function changeiMageblank()
{
 var inputs = document.getElementsByTagName("img");
 for(i = 0; i<inputs.length; i++)
 {
  if(inputs[i].getAttribute("src").indexOf("/_layouts/images/rect.gif") != -1)
    {
      inputs[i].parentNode.removeChild(inputs[i]);
    }
 }
}
function changeiMageblank1()
{
 var inputs = document.getElementsByTagName("img");
 for(i = 0; i<inputs.length; i++)
 {
  if(inputs[i].getAttribute("src").indexOf("/_layouts/images/rect.gif")!= -1)
    {
    inputs[i].parentNode.removeChild(inputs[i]);
    }
 }
} 
</script>

Add the above code in the CEWP of the page where the survey overview is rendered.

hideanchor Function hides the hyperlinks 
changeiMageblank Function removes the images

5 comments:

  1. Thank you very much. Exactly what I have been looking for.

    ReplyDelete
  2. Really Helpful!!

    ReplyDelete
  3. Great job. Thanks for sharing.

    ReplyDelete
  4. Thank you sharing this code.

    ReplyDelete
  5. Thank for your share!!

    ReplyDelete