1

I'm trying to execute some code if a user decides to cancel their file selection using ng-flow, via a Upload File button. I don't know how to catch this event

I've tried using flow-file-error and flow-error directives to no avail. The code I pass in does not execute

<div flow-init="{target: '/api/InternalToolsDataSource/Incentive/Flow'}"
     flow-name="obj.flow"
     flow-files-submitted= "mapper.uploadFile($flow)"
     flow-file-success="mapper.uploadSuccess($file, $message)" 
     flow-files-error="mapper.handleUploadError($file, $message)" 
     flow-error="mapper.handleUploadError($file, $message)" 
     flow-file-complete="alert('complete')">

I want to find a solution to be able to execute a function after the file selection process is cancelled through the external window that pops up. Thoughts?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Drake Gens
  • 11
  • 1

1 Answers1

0

According to the events listed in the flow.js documentation, there is no event for when the file selection popup is cancelled.

Since the filesSubmitted event only fires once a file is successfully chosen, it may be best to just wait for that event and don't attach anything else to the upload button that may put the UI in an unexpected state.

Related non-flow question has some possible solutions using the onchange/onblur events: Cancel event on input type="file"

Jason Weinzierl
  • 342
  • 1
  • 6
  • 12