Skip to content

Commit a9b38b3

Browse files
committed
Fix 21: Ask for confirmation before clearing file
1 parent cf7746a commit a9b38b3

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/components/form.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,17 @@ export class FormFileInput extends React.Component {
411411
}
412412

413413
clearFile = () => {
414-
let event = {
415-
target: {
416-
type: 'text',
417-
value: '',
418-
name: this.props.name
419-
}
420-
};
414+
if (window.confirm('Do you want to remove this file?')) {
415+
let event = {
416+
target: {
417+
type: 'text',
418+
value: '',
419+
name: this.props.name
420+
}
421+
};
421422

422-
this.props.onChange(event);
423+
this.props.onChange(event);
424+
}
423425
}
424426

425427
render() {

0 commit comments

Comments
 (0)