Skip to content

Commit

Permalink
Fixed duplicated file uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
tsv2013 committed Feb 9, 2024
1 parent 4ab9812 commit 43360d4
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div [class]="model.fileRootCss" #contentElement>
<input [class]="model.cssClasses.fileInput" *ngIf="!model.isReadOnly && model.hasFileUI" tabindex="-1" type="file"
[attr.id]="model.inputId" (change)="model.doChange($event)" [attr.aria-required]="model.ariaRequired"
[attr.id]="model.inputId" [attr.aria-required]="model.ariaRequired"
[attr.aria-label]="model.ariaLabel" [attr.aria-invalid]="model.ariaInvalid"
[attr.aria-describedby]="model.ariaDescribedBy" [attr.multiple]="model.multipleRendered"
[attr.title]="model.inputTitle" [attr.accept]="model.acceptedTypes" [attr.capture]="model.renderCapture" />
Expand Down
1 change: 0 additions & 1 deletion packages/survey-vue3-ui/src/File.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
tabindex="-1"
type="file"
:id="question.inputId"
@change="question.doChange"
:aria-required="question.ariaRequired"
:aria-label="question.ariaLabel"
:aria-invalid="question.ariaInvalid"
Expand Down
2 changes: 1 addition & 1 deletion src/knockout/templates/question-file.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div data-bind="css: question.fileRootCss">
<!-- ko ifnot: question.isInputReadOnly -->
<!-- ko if: question.hasFileUI -->
<input type="file" tabindex="-1" data-bind="css: question.cssClasses.fileInput, attr: { id: question.inputId, 'aria-required': question.ariaRequired, 'aria-label': question.ariaLabel, 'aria-invalid': question.ariaInvalid, 'aria-describedby': question.ariaDescribedBy, multiple: question.allowMultiple ? 'multiple' : undefined, title: koInputTitle, accept: question.acceptedTypes, capture: question.renderCapture }, event: { change: question.dochange }">
<input type="file" tabindex="-1" data-bind="css: question.cssClasses.fileInput, attr: { id: question.inputId, 'aria-required': question.ariaRequired, 'aria-label': question.ariaLabel, 'aria-invalid': question.ariaInvalid, 'aria-describedby': question.ariaDescribedBy, multiple: question.allowMultiple ? 'multiple' : undefined, title: koInputTitle, accept: question.acceptedTypes, capture: question.renderCapture }">
<!-- /ko -->
<!-- /ko -->
<!-- ko if: question.isReadOnly -->
Expand Down
4 changes: 2 additions & 2 deletions src/question_file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,8 @@ export class QuestionFileModel extends QuestionFileModelBase {
}
}
doChange = (event: any) => {
// var src = event.target || event.srcElement;
// this.onChange(src);
var src = event.target || event.srcElement;
this.onChange(src);
}
doClean = () => {
if (this.needConfirmRemoveFile) {
Expand Down
2 changes: 0 additions & 2 deletions src/react/reactquestion_file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class SurveyQuestionFile extends SurveyQuestionElementBase {
id={this.question.inputId}
ref={input => (this.setControl(input))}
style={!this.isDisplayMode ? {} : { color: "transparent" }}
onChange={!this.isDisplayMode ? this.question.doChange : (() => {})}
multiple={this.question.allowMultiple}
placeholder={this.question.title}
accept={this.question.acceptedTypes}
Expand All @@ -50,7 +49,6 @@ export class SurveyQuestionFile extends SurveyQuestionElementBase {
id={this.question.inputId}
ref={input => (this.setControl(input))}
style={!this.isDisplayMode ? {} : { color: "transparent" }}
onChange={!this.isDisplayMode ? this.question.doChange : (() => {})}
aria-required={this.question.ariaRequired}
aria-label={this.question.ariaLabel}
aria-invalid={this.question.ariaInvalid}
Expand Down
1 change: 0 additions & 1 deletion src/vue/file.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
tabindex="-1"
type="file"
:id="question.inputId"
@change="question.doChange"
:aria-required="question.ariaRequired"
:aria-label="question.ariaLabel"
:aria-invalid="question.ariaInvalid"
Expand Down

0 comments on commit 43360d4

Please sign in to comment.