survey-creator icon indicating copy to clipboard operation
survey-creator copied to clipboard

Custom save button with disabled state in survey editor

Open hekin1 opened this issue 2 years ago • 1 comments

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 avatar Jun 09 '22 07:06 hekin1

@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

andrewtelnov avatar Jun 09 '22 10:06 andrewtelnov