Monday 27 August 2012

Change the Text "Respond to this Survey" in Survey list

We can create Survey in SharePoint using the Survey Template & add questions in the survey. After creating the survey, user can see the details of the survey as shown below.




Now to respond to the survey user clicks on the "Respond to this survey" link.

In the same way I want to create a quiz using the survey template. But after creating the quiz it shows "Respond to this survey" link which I don't want. I want to display "Respond to this Quiz". Also I want to change the text "Survey Name" & "Survey Description" to "Quiz Name" & "Quiz Description" respectively.

We can achieve this by adding the Javascript. Add a CEWP on the Survey page & add the following script in the CEWP. 


<script type="text/javascript">
$(document).ready(function() {
$('[title]').removeAttr('title');
changespantext();
changeName();
});

function changespantext()
{
  var spans = document.getElementsByTagName("span");
    for(var i=0;i<spans.length; i++)
   {
    if(spans[i].innerHTML == "Respond to this Survey")
     {                                                //is this the "Respond to this Survey" span?
        spans[i].innerHTML = "Respond to this Quiz";  //change to new value
         break;                                      //hop out of the loop, we're done
     }
   }
}

function changeName()
{
   var tdid= document.getElementById("overview01");
   var tdid1= document.getElementById("overview02");

   tdid.innerHTML="Quiz Name:";
   tdid1.innerHTML="Quiz Description:";
}

 </script>

Now stop editing the page & you will see the changes as follows.





9 comments:

  1. Great post! However, this change on overview.aspx does not push to newform.aspx. When you click on the Respond to this Quiz URL, it opens the quiz in newform.aspx window, but 'Respond to this Survey' still displays at the top of the form. How do you rename that text on the newform.aspx (and subsequently editform.aspx) page?

    ReplyDelete
    Replies
    1. Hi Did you come to know how to change text on newform.aspx?

      Delete
    2. Hi did you come to know how to change text on newform.aspx

      Delete
  2. does not work for share point 2013

    ReplyDelete
  3. where is designer do i find CEWP?

    ReplyDelete
  4. does not work for share point foundation 2013... any idea ?

    ReplyDelete
  5. Does not work for SharePoint 2013, any ideas?

    ReplyDelete
  6. Does not work for SharePoint 2016 (Office 365), any ideas?

    ReplyDelete