views:

336

answers:

2

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

+1  A: 

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.

Hojo
A: 

I'm want to do the same but it does not work, I made the same only change the ID for this 'ctl00_m_g_1ffcca64_6fec_4a91_a3a4_3c0488d3d066_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField'

Rafael Hernandez