Welcome to the LimeSurvey Community Forum

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

How to create a question with the option to add another line?

  • DOwen
  • DOwen's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 2 months ago #123851 by DOwen
We are building a survey which asks for a list of products required. The products are chosen from a set list of 50 inside a dropdown. They can choose as many products as they want. However I cannot find a way of creating a question that allows the user to add another line containing the dropdown, as well as a small text box, and continue to keep adding more. The only thing I can think of is to create a very large amount of questions and hide them all. Is there a solution?

We also need similar questions where we the user will describe an event with four questions together (eg Start Date, End Date, Title, Description). We would like the user to be able to keep adding as many events as they want here too.

Ideally a '+' button or similar would be great which creates another space to add an answer.

Can anyone help please?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #123863 by holch
There is no "loop" function in Limesurvey. So the only way is as you imagined: create as many questions or answer options as you think makes sense (for the products a maximum of 50 I guess) and hide them.

There was a workaround of Tpartner somewhere that actually had the option of "adding" an additional answer option by clicking on a button, if I remember right. But this was quite a while ago. You would have to search the workaround section and the forum to see if you can find it.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • DOwen
  • DOwen's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 2 months ago #123876 by DOwen
That's a shame. I'm sure hiding the answers can be effective enough. I couldn't find anything from Tpartner on the forum though...
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #123928 by tpartner

There was a workaround of Tpartner somewhere that actually had the option of "adding" an additional answer option by clicking on a button

Variable Length Array - www.limesurvey.org/manual/Workarounds:_M...ble_Text.29_question

(it's quite old but should give the idea)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DOwen
  • DOwen's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 2 months ago - 9 years 2 months ago #123940 by DOwen
Oh great thanks Tony!

Does this only work for array questions though?

I would like a group of questions (non-array questions) to appear when clicking on the 'add' button, rather than just create a new row inside an array question. Is this possible?
Last edit: 9 years 2 months ago by DOwen.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #123981 by tpartner
I'm sure the workaround could be modified to handle questions instead of array rows but I don't have time for that today.

Having said that, from your original post, it seems to me that you want to be using an array-text type question for your text inputs. You would need to replace the text inputs in the first column with drop-downs - something like this - www.limesurvey.org/en/forum/can-i-do-thi...boxes?start=10#95370

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DOwen
  • DOwen's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 1 month ago #126028 by DOwen
Hey, had to bring this back again. Unfortunately this went on the back burner, until now.

So I've had another look into this and I don't think tan array question would work in all cases, in particular questions where a large text box will be required. (eg a group of questions such as Name, date and description would be Item 1, then the user clicks on a button which displays another batch of the same group as Item 2).

Can anyone else agree that showing and hiding questions is the best way forward? However I'm still not sure how an Add Item or similar button would be added in this case?
The topic has been locked.
  • DOwen
  • DOwen's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 1 month ago - 9 years 1 month ago #126231 by DOwen
Would anyone please be able to offer any assistance?

Ideally need to achieve what I've tried to display in the attached wireframe.

So basically, a section in the survey where the user is asked to specify certain items labelled 1, 2, 3, etc. (sub headings 'Item 1', 'Item 2', etc may not be required) and a description of each item. There could be any number of items from 1 to 20 approx. So they need the ability to add another 'Item # Name' and 'Additional Information'.

We are then outputting the completed survey at the end to PDF (using TCPDF) which would have all the items and their descriptions listed.

I'd need to apply this same sort of question/answer format to other questions too where there would be more fields.

Last edit: 9 years 1 month ago by DOwen.
The topic has been locked.
  • DOwen
  • DOwen's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 1 month ago #126262 by DOwen
Tried to use Tpartner's workaround but would prefer not to use Array, although struggling to manipulate the script based on the Array question type for another question type.
The topic has been locked.
  • DOwen
  • DOwen's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 1 month ago #126266 by DOwen
just tried using the workaround with the array question type anyway and its not working. The plus button is there, and a minus button appears when the plus button is selected, but that's it, nothing else happens.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
9 years 1 month ago #126303 by Mazi

holch wrote: There was a workaround of Tpartner somewhere that actually had the option of "adding" an additional answer option by clicking on a button, if I remember right. But this was quite a while ago. You would have to search the workaround section and the forum to see if you can find it.

There it is: www.limesurvey.org/manual/Workarounds:_M...ble_Text.29_question
Demo: www.partnersinc.biz/surveys//index.php?s...32&newtest=Y&lang=en

But you may have to adjust this depending on which template you are using.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • DOwen
  • DOwen's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 1 month ago #126305 by DOwen
I've tried this with array questions to test it (as well as other question types) but cannot get it to work. Whether I put the scipt inside the .JS file or the question/group description :(
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose