Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Inserting boilerplate in array text

  • Nazysh01
  • Nazysh01's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 7 months ago #139621 by Nazysh01
Inserting boilerplate in array text was created by Nazysh01
Hi,
I want to design something like this on lime survey:
Please comment against following water sources:
Distilled water(text display)

D1(text box)
D2 (text box)
D3(text box)

Purified water
P1 (text box)
P2(text box)
P3 (text box)

To my understanding I make Q1 an array(text) and then Q2 and Q3 a boilerplate, I hide both of these and append them in the array on their respective places. I am stuck with code, please help me on this. Need to deliver this tomorrow.

Many thanks
The topic has been locked.
  • Nazysh01
  • Nazysh01's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 7 months ago #139624 by Nazysh01
Replied by Nazysh01 on topic Inserting boilerplate in array text
Found this code while desk research-ing
1 <script type="text/javascript" charset="utf-8">

$(document).ready(function() {

// Identify the questions
var q1 = $('#question'+{QIA}+'');
var q2 = $(q1).nextAll('.text display:eq(0)');

// Hide the text display question
$(q2).hide();

// Move the hidden text display input into the array
$('th.answertext:'first', q1).append($('input[type="text display"]', q2));

// Some styling...
$('input[type="text"]', q1).css({
'width': '50%'
});
});
</script>

I am trying to make q2 a text display instead of a text box and replacing word "text" with "text display" in the code everywhere. Since I want this boilerplate to sit after Row1 so i'm replacing "('th.answertext:first', q1) with "('th.answertext:row1', q1)". I have tweaked the code thousand time to no avail. Please someone help me on this.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago - 7 years 7 months ago #139626 by DenisChenu
Replied by DenisChenu on topic Inserting boilerplate in array text
Q1 : text display : " Please comment against following water sources:"
Q2 : Multi short text "Distilled water" / + Sub question
Q3 : Multi short text "Purified water" / + Sub question

And it's OK, no ?

Surely something i don't understand , because i don't see any difficulty here.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 7 years 7 months ago by DenisChenu. Reason: Add the question text to Q2 and Q3
The topic has been locked.
  • Nazysh01
  • Nazysh01's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 7 months ago #139631 by Nazysh01
Replied by Nazysh01 on topic Inserting boilerplate in array text
Denis, you are a life saver. How can I not think of this at first place. I was catering this through array(text). Thank you so much.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose