[ReactFilePondUpload] How to disable button if no selected file? (Reactive Filepond)
Forge component by Stuart Harris
Application Type
Reactive

Is it anyway to disable button if no file was uploaded?

Thank you.

Capture.PNG

Hello,


You can make use of FilePondUpload_GetTokens client action and the Uploaded event from the UploadBlock webblock: 

  • create a boolean variable and put it on the enabled property of the button, by default it should be False (since no file was uploaded yet)
  • create a handler for the Uploaded event and using the FilePondUpload_GetTokens action check if the tokens is empty (nulltext or "") and if so, leave the button disabled, otherwise if you receive any token(s) you can set the boolean variable to True

Hope this answers your question :)


Regards,

Bogdan

Hi,

You can check the logic by checking the file variable(binary data type) is null or not.

If it is null then make the button to be as disabled else make it vice versa.


Thank You!

Happy coding,

Saksham Srivastava

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.