Hello, is there a way to disable the DnD of a file question? Leaving just the option of uploading a file when clicking on the Upload button.
Disable File question DnD
Answers approved by surveyjs Support
Hello Amit,
We don't have this functionality.
Why do you need to disable this functionality?
Thank you,
Andrew
SurveyJS Team
Comments
(2)
AB
9 months ago
There is a requirement to disable DnD.
I managed to do this as follows:
JavaScriptconst onAfterRenderQuestion = useCallback(
(_: Model, { question }: AfterRenderQuestionEvent) => {
if (isFile(question)) {
const file = question as unknown as QuestionFileModel;
//Disable all file DnD events
file.onDragOver = (e) => e.preventDefault();
file.onDragLeave = (e) => e.preventDefault();
file.onDragEnter = (e) => e.preventDefault();
file.onDrop = (e) => e.preventDefault();
}
},
[]
);