- Posts: 23
- Thank you received: 0
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
- Topic Author
- Offline
- Junior Member
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
- Offline
- LimeSurvey Community Team
- Posts: 12942
- Thank you received: 3979
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
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 0
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
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
- Posts: 10109
- Thank you received: 3593
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
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 0
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
- Posts: 12942
- Thank you received: 3979
You did what?and put the question ID
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
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 0
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.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
- Posts: 12942
- Thank you received: 3979
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
- Offline
- LimeSurvey Community Team
- Posts: 10109
- Thank you received: 3593
Look in the browser console (F12) for JavaScript errors.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)
Here is a working example:
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
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 0
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
- Posts: 12942
- Thank you received: 3979
Is there an error message?
And:
You mentioned this line
// Call the function with a question ID varLengthArray({QID});
And the function itself which takes this parameter in the variable "qID" (you are free how to call it)
// 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
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- vixitasurveys
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 0
Please Log in to join the conversation.