March 1, 2011
Solved:Display picture from Rich Text Field with XPages
Im having a Form where I have a Rich Text Field(lets call it imageField) added there to hold an image. The user of the Form will directly copy an image into the imageField , not the location of the image, THE image will be copied into the field.
When I then later try to display this image on a Xpage nothing comes up..
Google wont help me with this particular problem either. Anyone out there know how to do this?
SOLVED:
As Ben over at My Comfy Chair pointed out this is in fact quite easy to solve.
Start by making the Rich Text Field save as HTML and MIME. After that you simply refer to the field in the src part of the img tag:
src=\"myView/"+itemInView.getDocument()+"/FieldName/M2?OpenElement"
Worked like a charm for me! Thanks alot Ben!
Subscribe to:
Post Comments (Atom)
Sure, you just need to set the imageField to save as HTML and MIMEm, then reference the mime part in your img src. It will have a format like:
ReplyDeletehttp://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement
Thank you Ben! Will try this out right away!
ReplyDeleteWorked like a charm! Thank you Ben!
ReplyDeleteCan you please explain how to do this? I'm quite new in Xpages and i''ve been struggling for two weeks to get it to work... Tnx
ReplyDeleteWhat i need is this, when i create a document i need an image to be added just like the one you have added here, or (by choice) to be at the end of the document. Afterwards i need an option to change the image in the document or simply delete it. Thank you!
Please help me in retrieving value of a rich text field and display it in another richtext or a computed field
ReplyDeleteFirst of all, you can't use img in Xpages, and src won't work with xp:image
ReplyDelete