Insert Image via URL

Jakub Synowiec
Kilo Expert

Hey,

I want to insert an image into a form with an URL and not included Image field type.
How do I do that?
I used HTML box and marked is as read only, it works but it shows two buttons ( - and + ), remove and add lines to the script area.
I tried to get rid of this buttons using System UI -> Field Styles, but I am not able to stylize anything outside the context of the field box.

Example attached below.

Thanks for any help!

1 ACCEPTED SOLUTION

Alright, I've dig a little bit deeper in this situation.
Basically what I did is access the plain HTML from a client script and removed the <div> element that held these two buttons.
I did it within onLoad client script.
JS code:
g_form.getFormElement("u_html").elements["x_58872_needit_needit.u_html"].parentElement.firstChild.innerHTML = "";



parentElement on the u_html element is the container for the context of HTML field. Therefore it holds both "+" and "-" buttons and the HTML view.
The firstElement is the <div> element containing these buttons, so if I replace them with an empty string, the buttons dissapear.
End result:




find_real_file.png


View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Jakub,



Can you explain it in more detail?


Also where is the screenshot.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

bawiskar I was pretty sure the screenshot was attached the first time.
This is what I have so far. Pay attention to the Image labeled field on the right. It's a html page with read-only setting. You can see these '-' and '+' signs at the same level where the Image label is.
The W3 is the image I inserted via html and the red background is the CSS style that I implemented using System UI -> Field Styles.
DeepinScreenshot_20170821091705.png
Once again, I want to have an image field, using URL and not uploading a file to ServiceNow DB.
If there is any better way of doing it instead of HTML field, I'd be glad to know it!
Thanks


Hi Jakub,



As far as I know you can store image in images table and have that in image field and other way is html field.


I don't think any other way exist to achieve this apart from the above 2 approaches.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

bawiskar
I appreciate your response, but you did not solve my problem. I want to have these "+" and "-" buttons removed from above the image.
I already know that you can insert image in these two ways, just neither of those satisfy my requirements.