Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Dynamically add data from external JS file

Hello everyone!

I tried searching for a similar question but could not find one. If this has been asked before my apologies.

I am creating a custom module which needs to dynamically add variables
to lighthouse to store (could be an indefinite number of values, depending on the user). Now I just included my module in the head of each questionnaire so its not a lot of work for other colleagues to set up.

I prefer to keep it as easy to set up as possible thus wrote everything externally. Is it possible to create like for example pass in fields dynamically?

Thanks in advance!
asked Oct 4, 2018 by JaymevG (120 points)
Dynamically adding pass-in fields is not supported in the software, unfortunately.  When a study is uploaded, only so many database fields are created.  For a user to apply your script, they'll need to determine a maximum number of values they wish to record and your module will need to behave accordingly.

It may be relevant to consider that many values can be stored in a single text field using something like "1,2,3,4,5" or JSON, but even that cannot support indefinite amounts of data.

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.