Sharepoint Survey: Can I add a comment box to a question?
by Hojo Clement • March 2, 2010 • MOSS 2007 • 4 Comments
Recently, there was an interesting question in stackoverflow
I am doing a survey in SharePoint, using the built in survey tool.
I want to add a comment box next to my “ratings” questions. e.g.
Q1. Do you like fish?
- Not at all
- They’re alright
- I love fish!
Comment:
How can I do this all within one question? I can obviously add a new text question, but this will become Q2, and I want it to be part of the same question.
Any idea how I can do this?
By default SharePoint does not give us this option. So how can you do this? Here is a work around.
- Add a Question, with Text box, below the question under which you need this comment box.
- Edit the Newform.aspx page and insert a content editor webpart in the below of existing survey webpart.
- Copy and paste the below code in the content editor webpart
<script>
var tables
tables = (document.getElementById('ctl00_m_g_c7647c31_a9f9_4f27_aa53_e0728c485b2c_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_
ctl00_ctl00_TextField').offsetParent).offsetParent;
var i
var str
for(i=0;i<tables.rows.length;i++)
{
str = tables.rows[i].cells[0].innerHTML;
str = str.substring(0,7)
//alert(str);
if(str == 'Comment')
{
tables.rows[i].cells[0].innerHTML = '<table width=400px border=0><tr><td><font color=blue size=3></font></td></tr></table>';
}
}
</script>
In the above code ctl00_m_g_c7647c31_a9f9_4f27_aa53_e0728c485b2c_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField is the ID fo the Comment Textbox control. (You can get it by Viewing the Source code of the page).
All we do is get the container of the Textbox control and hide it. Here is the screenshot of a sample survey


hey info with regard to this site really helpfull,please visit our site Daily Review
watching just about for the most effective web-site getting 1.
I need to create a survey in sharepoint 2010.for a single question i need more than one answer type.for example i have a question
q1) who is tall?
a)raja
b)gopal
c)rajkumar
Now i need to add another text box below this with an description “Others” to enter an Answer other that of those options listed above.
can u give me the solution.
Great post.
Now, how do you achieve the same effect in SharePoint 2010?