[Ticket cloned from T22119: Custom Previews for File Upload Questions]
when survey's mode is 'display'.still can delete file or delete button should be hidden,how to fix this issue.
[Ticket cloned from T22119: Custom Previews for File Upload Questions]
when survey's mode is 'display'.still can delete file or delete button should be hidden,how to fix this issue.
Hello,
Within your custom component's code, check whether a file upload is isReadOnly
or a survey is in read-only mode (SurveyModel.readOnly
) and disable the delete file button: View Demo.
Let me know if you have any further questions.
By the way,I am confused whether the following two variables are equal,Is survey equal question.survey ?
JavaScriptconst survey = new Survey.Model(dataSource);
const isReadOnly = question.isReadOnly || (question.survey && question.survey.readOnly);
Hello,
The question.isReadOnly
property returns true
if a question or its parent is read-only. When you enable a survey's read-only mode, a question is not explicitly set read-only; its parent is a PageModel
instance and it's not read-only as well. Therefore, when you render a custom file preview component, you may want to check both these settings: question.isReadOnly
and survey.readOnly
.
I hope this information helps. Let me know if you have more questions.