survey-creator
survey-creator copied to clipboard
Custom save button with disabled state in survey editor
Are you requesting a feature, reporting a bug or ask a question?
Asking a question
What is the current behavior?
The default save icon in survey creator is a small floppy disk. I added a custom button to my html page, which will save the survey to backend.
<button type="button" v-on:click="saveSurveyToBackend()">Save</button>
What is the expected behavior?
However, this button is always enabled. I would like it to act as the floppy-icon which is disabled/enabled based on if the user has done any changes to the survey-json object.
Is it possible to get true or false from your survey creator api, if any changes has been done by the user in the editor?
Thanks!
@hekin1 You can use creator.onModified event and check their creator.state === "modified"
to enable button and disabled it on saving.
the state becomes (creator.state), "saving" or "saved".
Thank you, Andrew