Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display and handle <input type="file"/> #134

Closed
shershen08 opened this issue Jun 2, 2022 · 1 comment
Closed

Display and handle <input type="file"/> #134

shershen08 opened this issue Jun 2, 2022 · 1 comment

Comments

@shershen08
Copy link

shershen08 commented Jun 2, 2022

Current implementation does not allow to create a custom file.

In my field config I set the event property to follow the 'change' event and then trying to fill in the value with file content as so:

// other props
 events: {
        change: ($event, context) => {
          if (type === 'file') {
            context.updateField({id: item.id, value: $event.target.files[0]})
          }
        }
      },

with this I get -

runtime-dom.esm-bundler.js?d1f7:1237 Uncaught (in promise) 
DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, 
which may only be programmatically set to the empty string.
@mesqueeb
Copy link
Member

mesqueeb commented Jun 2, 2022

i think there's no way around this limitation as it's the rules of the input type=file

the only thing you can do is create your own custom Vue component that's a wrapper of input type=file.

Since blitzar has the philosophy of "bring your own components" providing this for you is out of the scope of this library though 😅

good luck!
--
Blitzar was made with 💜 by Luca Ban.
You cannot sponsor every project, but next time you do, think of this one for its prolonged maintenance.

@mesqueeb mesqueeb closed this as completed Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants