Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: mdbFileInput with vue: how to programmatically set src

jann_ro free asked 4 years ago


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.


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



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: 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