[IGN-3351]Reset FileUpload component from script

Is there a way to invoke the “clear uploads” button on the File Upload perspective component via scripting?

I’m working on a form and the user uploads a file, but after they click the submit button, I want the uploads to clear automatically.

Not currently, but I’ve attached you to the existing ticket for this feature, which will help raise its priority.

I don’t know if we can upgrade the priority of this, but my form is causing duplicate files to be sent to the database because there’s not a way (that I know of) to clear the uploads from a script.

When the user taps the “submit” button, the script send all of the form details (including any uploaded file) to the database, and when it finished the script, it runs a “clear form” script to clear the data, but I can’t clear the uploaded files, so then the next entry has the previous entry’s uploaded file.

Thanks!

I’d also like the ability to perform this reset programmatically. In my use case, we do some validation on an Excel document that the user uploads. If the validation fails, we show an error message, but the FileUpload component still shows that the upload was successful. This could be confusing to end users, so I’d like to reset the component’s state if the validation fails.

This will be possible in 8.1.18. Full release is expected mid June.

1 Like

Awesome. Glad to hear that. Thanks, Paul.

It depends on where you're trying to do this from, but you need to reference the File Upload component in some manner, and then invoke the component function:

# from a sibling component, and assuming your File Upload has not been renamed
self.getSibling("FileUpload").clearUploads()

# from a script which belongs to the File Upload component
self.clearUploads()
1 Like

This is only working in a session and does not fire in a designer session

And? There are many aspects of both Vision and Perspective that do not function in the designer. This, in itself, is not a bug. Simply a limitation of a partial runtime intended for graphical design.

2 Likes