B4J Question [BANanoVuetifyAD3] how cancel VFileInput text

Lello1964

Well-Known Member
Licensed User
Longtime User
I have a VFileInput object to select the image to save,
after saving the image I would like to reset the name of the last selected image, how can I reset the value of VFileInput?
 

Mashiane

Expert
Licensed User
Longtime User
If I understand you correctly....

Currently if you select a file via the VFileInput, you cannot select the same file again after uploading it, however you can select another file to upload.

This is one of those funny issues with the underlying <input type="file"> controls.

After the upload is complete... / whenever.

B4X:
'refresh active pag references
page.RefreshActiveRefs(Vuetify)
'reset the file input
page.NullifyFileSelect("nameofmyfileinput")
 
Last edited:
Upvote 0

Lello1964

Well-Known Member
Licensed User
Longtime User
i've tryed, but doesn't work.
VFileInput object name is : VFileInputLogo
after saving image and prepar for next input.:
        'refresh active pag references
        Page.RefreshActiveRefs(vuetify)
        'reset the file input
        Page.NullifyFileSelect("VFileInputLogo")

errore.png
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
What is the value on the VFileInput, "VModel" property? By default this is set to 'file1'. I suspect that is the reason and if there is a value there, then the app still recognized that content as containing whatever you selected as a file and thus has not been automatically cleared.

A VModel for the file input for example is usable where you have a VImage on the page and after selecting the file you want to preview/show it on the same page. Using the VModel "variable" of the VImage here automatically updates the image after the file is read. This could also be the "field" name of your db.table where you want to save the base64 string of the image (for saving), for reading, you can use that vmodel to show an image.

If there is a value in VFileInput VModel, then you have 2 options

Option 1 - Clear the VModel at runtime..

B4X:
page.RefreshActiveRefs(Vuetify)
VFileInput.Clear(page)

This will clear the vmodel and also nullify the VFileInput.

Option 2

Remove the "variable" name from the VFileInput VModel property and leave it blank.
 
Upvote 0
Top