ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Show Image after Save of Attached Image


#1

I have a field of type attached image. By default its showing the attached image’s filename. What I want to achieve is on save, I want to show that image there not the file name. Any suggestions/help will be appreciable.

Thank You


#2

There is one another datatype i.e attach, which shows image after attaching image


#3

yup but problem with that is , to attach data there, you first need to save the file and anyone remove it untill it is in save state.

Any way to overwrite these two things in attach type ?


#4

For that you need to make changes on attachment.js


#5

I´d recommend creating a html field to show the image an then, on the form´s validate event, populate that field with the image´s route so you can visualize (and manipulate) as needed.

Good Luck!


#6

An if-else statement with refresh field worked for me. Thanks BTW :slight_smile:


#7

Can you elaborate more? Did you take another field to show image ? Can you paste your code?


#8

Actually I don’t have that code now. What I was trying to achieve there is when you make attach image type field, then url also comes along with image. I was trying to hide the url segment and make the image kind-of more large so as to be visible more properly.

What i did was played with jquery in custom script and used if-else statement that if there’s file(image) attached, hide the default way it represents and show image with dimensions I provided