Topic: mdbFileInput with vue: how to programmatically set src
I am using mdbFileInput with img
How do you validate the component? If I use v-on:getValue, I can check the image format or size but how do i stop it updating the image if incorrect?
I even tried to access the dom directly to reset the src but it does not work getFileInputValue() { this.$nextTick(function () { this.$refs.image.$el.childNodes[0].childNodes[0].src = "https://mdbootstrap.com/img/Photos/Others/placeholder-avatar.jpg" }) },
The component is not usable if validation can't be performed and url is always updated even when validation fails.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Free
- Premium support: No
- Technology: MDB Vue
- MDB Version: 6.7.2
- Device: Windows
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: Yes
Mikołaj Smoleński staff commented 4 years ago
In this component you can't stop updating the image, but You can prevent form from submitting if the image is incorrect or You can prevent accessing next step of the form in such case. You can also show a notification with an alert.
Best regards