Welcome to the LimeSurvey Community Forum

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

create matrix table

  • MariaKam
  • MariaKam's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #268199 by MariaKam
create matrix table was created by MariaKam
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
(Write here your question/remark)

Hi community !!

I'd like to help me with my issue as fas as the matrix table is concerned . My first question to the questionnaire is how many children do you have, it's a number input question and the code of this is G03Q16. The second question has to do with children's characteristic like age and gender. I created a script in which I want to show me a table with to many rows as the number of the children. If I have 2 children I want to rows, one for the child 1 and one for the child 2, and in columns I want one for the age and one for the gender in which by dropdown I choose what suits me. The problem is that I cannot find the problem why it appears a table which does not take into account the information above, for the number of children. Please can you help me?What I am doing wrong.


The script:

<table border="1" width="100%">
    <thead>
        <tr>
            <th>Child</th>
            <th>Age</th>
            <th>Gender</th>
        </tr>
    </thead>
    <tbody>
        {for (var i = 1; i <= G03Q16; i++) {
        '<tr>
            <td>Child ' + i + '</td>
            <td>
                <select>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                    <option value="11">11</option>
                    <option value="12">12</option>
                    <option value="13">13</option>
                    <option value="14">14</option>
                    <option value="15">15</option>
                    <option value="16">16</option>
                    <option value="17">17</option>
                    <option value="18">18</option>
                </select>
            </td>
            <td>
                <select>
                    <option value="Άρρεν">Άρρεν</option>
                    <option value="Θήλυ">Θήλυ</option>
                    <option value="Άλλο">Άλλο</option>
                </select>
            </td>
        </tr>';
        }}
    </tbody>
</table>


I hope everything is understandable! 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #268207 by Joffm
Replied by Joffm on topic create matrix table
Hi,
I wonder why you did not answer the questions at the beginning about your LimeSurvey version, the hosting, etc.
And your question is obviously not "plugins" related.

Well,
1. There are many mistakes in the script.

But why do you use a script to create an array?
Here ypu can use an array(text) with inserted dropdowns as it is shown here many times.

Like this
Four children
 

Two children


 

File Attachment:

File Name: limesurvey...4879.lss
File Size:36 KB


Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • MariaKam
  • MariaKam's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #268210 by MariaKam
Replied by MariaKam on topic create matrix table
Hi Joffm,

I am a very new user, so I am still trying to get used to it and learn! Thank you very much for your comment; it was incredibly helpful! You made my life much easier.

Maria

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose