Welcome to the LimeSurvey Community Forum

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

Dropdown in text array along with option to add more rows to the array

  • vixitasurveys
  • vixitasurveys's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 months 4 days ago #250640 by vixitasurveys
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.2.7
Own server or LimeSurvey hosting: LimeSurvey Hosting
Survey theme/template:
==================

Hello,

I wish to create a survey to collect nominations from participants. We need people to add the name, email ID of their nominees and also, their relationship with the nominees (e.g., is the nominee their manager, team member, peer etc). For this field, we need to have a drop down with a fixed list.
In addition, we will need to allow the participants to add more data if they wish to. So they need to have a button to add more rows.

Can i add both these features? If so, how?

Thank you in advance!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 3 days ago #250646 by Joffm
Hi,
I understand that you know both the script to insert "drop-downs" in an array(text) and the script to "dynamically" add rows.
And your question is, if it is possible to combine them.
Yes, you can.
Here you find an example
[url] forums.limesurvey.org/index.php/forum/ge...el-4?start=12#250233 [/url]

The third and last script lets you adapt the width of the columns.

Can look like this
 

Joffm
 

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

Please Log in to join the conversation.

  • vixitasurveys
  • vixitasurveys's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 months 1 day ago - 7 months 1 day ago #250694 by vixitasurveys
Thank you for the help, but I am still trying to get it right. I shall try again and get back on this.
Edit:
To clarify, since I am not a programmer nor can I understand German, I am not able to follow the instructions well. When I input the code in the question text box, by enabling the script button on the editor. I am able to get the button for add row, but at least in the preview, it doesn't work when clicked. Please let me also know if I am doing something wrong.

Thanks again
Last edit: 7 months 1 day ago by vixitasurveys. Reason: explaining the issue after trying the suggestion

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 22 hours ago #250698 by tpartner
Here is the workaround for variable length array (scroll down for the 6.x code) - manual.limesurvey.org/Workarounds:_Manip...ble_Text.29_question

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • vixitasurveys
  • vixitasurveys's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 3 weeks ago #250866 by vixitasurveys
Thank you, but while the button does appear now, it does not do anything when pressed. I copied the 6.x code and put the question ID, hence the button shows up at the right place, but it does not work.
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 3 weeks ago #250887 by Joffm

and put the question ID

You did what?
Does it mean you changed {QID} to something? To what?
{QID} is a systemwide placeholder that always contains the actual question ID.
 

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

Please Log in to join the conversation.

  • vixitasurveys
  • vixitasurveys's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 3 weeks ago - 6 months 3 weeks ago #250933 by vixitasurveys
I followed the comments given here.
Link: manual.limesurvey.org/Workarounds:_Manip...meSurvey_version_6.x

Without putting the QID, it did not work.
(There was a line which said, "call the function with a question ID". I inserted the Question ID in the code below it. It as not working before that, after that, the "Add Row" button started appearing. But the problem is, pressing the button does nothing so far)

If that was incorrect, let me know please.
Last edit: 6 months 3 weeks ago by vixitasurveys.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 3 weeks ago #250966 by Joffm
Now, what can we say without seeing what you really did?
Please send the lss export.

You see many working examples here in the forum. So the issue seems to be on your side.

Joffm

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

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 3 weeks ago #250979 by tpartner

Without putting the QID, it did not work.
(There was a line which said, "call the function with a question ID". I inserted the Question ID in the code below it. It as not working before that, after that, the "Add Row" button started appearing. But the problem is, pressing the button does nothing so far)

Look in the browser console (F12) for JavaScript errors.

Here is a working example: 

File Attachment:

File Name: limesurvey...5464.lss
File Size:32 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • vixitasurveys
  • vixitasurveys's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 3 weeks ago #250989 by vixitasurveys
A little strange..I am not able to download (export) the .lss file. I can easily export other survey structure files, but not this one. i don't know why this is happening.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 3 weeks ago - 6 months 3 weeks ago #250990 by Joffm
What happens?
Is there an error message?

And:
You mentioned this line
Code:
       
// Call the function with a question ID
        varLengthArray({QID});
Yes, here the function "varLengthArray" is called and the parameter is the ID of the question, here entered by ExpressionScript {QID}
And the function itself which takes this parameter in the variable "qID" (you are free how to call it)
Code:
       // A function to add or remove rows of an Array (Multi Flexible)(Text) question
        function varLengthArray(qID) {

Well, here again a working example; I added the dropdown and as the cherry the option to have different widths of columns
 

File Attachment:

File Name: limesurvey...5464.lss
File Size:34 KB


 

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 months 3 weeks ago by Joffm.
The following user(s) said Thank You: vixitasurveys

Please Log in to join the conversation.

  • vixitasurveys
  • vixitasurveys's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 months 4 weeks ago #251628 by vixitasurveys
Thank you so much! I could get this working after importing this. However, the dropdown options are not working yet. i will continue to check and see how i can make that work. Again, thanks so much. This makes life much easier.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose