Survey-library: [jQuery] Recommended approach for saving state of custom widget in HTML question-type

Created on 6 Oct 2018  路  1Comment  路  Source: surveyjs/survey-library

Are you requesting a feature, reporting a bug or asking a question?

Asking a question

What is the current behavior?

I have a multi-page survey, and I need the user to specify files to be uploaded (on survey completion) in one of the pages. My idea was to use an HTML question-type and then append a custom file uploader to it (the default file question-type doesn't fit my needs) when that HTML question-type is rendered.

However, this approach requires me to append and remove the custom file uploader in order to save the state (i.e. keep list of what files the user wants uploaded). My understanding is that when the page changes, the HTML element is destroyed from the current page and then rendered from scratch again if the user comes back to that page.

I feel like I'm missing an obvious way of doing saving the state. How can I save the state of that custom widget _before_ it's destroyed by other survey events?

What is the expected behavior?

I would like to keep the state of the Fine Uploader widget between pages and between toggling of visibility of the HTML question-type.

How would you reproduce the current behavior (if this is a bug)?

Provide the test code and the tested page URL (if applicable)

Tested page URL: N/A

Test code

N/A

Specify your

  • browser: Chrome and Internet Explorer
  • browser version: Chrome 66 and Internet Explorer 11
  • surveyjs platform (angular or react or jquery or knockout or vue): jquery
  • surveyjs version: v1.0.46
question

Most helpful comment

Alright, after some random googling I realized that the answer was in my question -- just create a widget!

For others wondering how to do it, you can find an example of creating your own widget here (see the customwidget.js file): https://plnkr.co/edit/HdnYE5?p=preview

>All comments

Alright, after some random googling I realized that the answer was in my question -- just create a widget!

For others wondering how to do it, you can find an example of creating your own widget here (see the customwidget.js file): https://plnkr.co/edit/HdnYE5?p=preview

Was this page helpful?
0 / 5 - 0 ratings

Related issues

halexiev-hedgeserv picture halexiev-hedgeserv  路  4Comments

enricribas picture enricribas  路  3Comments

alexmc6 picture alexmc6  路  3Comments

dmitrykurmanov picture dmitrykurmanov  路  3Comments

spertusatti picture spertusatti  路  3Comments