Creating the number of textboxes in a textbox list dyanamically


I’m looking for a way to dynamically build a textbox list question based on a previous answer.  The first question will ask a respondent how many times they have experienced something.  The subsequent textbox list will provide a list of blank text boxes based on that number. 


How many times have you experienced “X”? _____

Please provide a brief description of each incident:




Is there a way to do this either with our without a custom script?


Amy answered
    Amy 16 Rep.

    Thanks Jim,

    That works pretty well.  We’ll have to determine what we think is the high end number they will fill in will be so that they get enough textboxes to fill in.  So not perfect but I think we can make it work.

    I was thinking that with a script there should be a way to create an array of numbers based on the answer that would dynamically pipe the boxes based on the number.  I’m not familiar enough with javascript or SG custom scripting yet to figure that out. 

    Thanks for the alternative!


    Amy commented
      • The underlying structure of the Textbox List is an HTML table, so a script would have to add table elements (tr, th, td) in addition to the input fields. I have never written a script for something like this, but I assume that it would be a complex piece of work. As an alternative you might be able to build the question and then use a script to hide the rows you don’t want. We just thought that it was easier to use Boolean operators instead of JavaScript.

      • Thanks Jim, for the additional information. My coding experience is with VBA and a little HTML so not sure I’m ready to undertake a complex piece of script yet. The idea of building the question and using a script to hide rows would still require my knowing the high number the respondent may enter, if I’m understanding correctly. So I think I”ll stick with your original suggestion which is pretty simple to implement. I think we can come up with a pretty good estimate of the high end. I appreciate your thoughts and assistance!


      My team has had to build similar questions.  We found that it was easier to use a series of textbox questions within a CUSTOM GROUP question instead of the TEXTBOX LIST.  You can apply logic to each question within the CUSTOM GROUP, so the first textbox would appear if the response to the “How many….” questions was less than or equal to 1.  The next textbox would appear if the response was less than or equal to 2, and so on.  

      You will have to make sure that your “How many…” question will yield consistent responses that can be used to trigger logic conditions.  We used a textbox question with the AUTOCOMPLETE function enabled to ensure consistent responses.


      Jim W (Moderator) answered


        Question stats

        • Active
        • Views5755 times
        • Answers2 answers
        • Followers1 follower