97
Views
3
Comments
[ReactFilePondUpload] How to disable button if no selected file? (Reactive Filepond)
reactfilepondupload
Reactive icon
Forge asset by Stuart Harris
Application Type
Reactive

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

Thank you.

Capture.PNG
2024-01-18 12-42-28
Bogdan Boglea

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

2024-07-18 04-13-51
Muneera Shaik

@Bogdan Boglea , thanks for the answer, But I see the "Uploaded" event is not being triggered. Though i have handled the event, the logic in the handler is not working to disable the button. 

My use case, i want to disable the input field until the file is uploaded,  i am able to achieve this by check "upload in progress" event.(checking if upload % is 100%)

But, now the user removes the file by clicking cross icon in the upload block, I want the button to disable again during that event.


Please help if you have any idea.

2020-09-14 11-04-23
Saksham Srivastava

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.