开发者

Sharepoint Survey: Can I add a comment box to a rating (Likert) question?

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?

  1. Not at all
  2. They're alright
  3. 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?

Ta,

Ben


I had a similar requirement once. There is no starightforward way for doing this. But here is a work around which I used.

1.Add a Question, with Text box, below the question under which you need this comment box.

2.Edit the Newform.aspx page and insert a content editor webpart in the below of existing survey webpart

3.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 of the Comment textbox control (You can get it by viewing source)

We get the container of this control (table) and then hide the question. Hope this helps. Let me know if you need more help.


There is a easy solution for this sort of requirements. while creating a new question have a look into the Additional Question Settings. There is option for "Allow 'Fill-in' choices:" Just tick the yes radio button. This will allow you an additional text field for commenting purpose for drop down list type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜