cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically set image source path/value in Adobe Livecycle designer

former_member546619
Discoverer
0 Kudos

Hi all,

I have 5 Image objects in a Form and want to set the image source/path dynamically on certain conditions. The images are stored locally in the same drive as .xdp file.

I am using the following code to set the value dynamically;

ImageForm.IMG_1.presence = "visible";

ImageForm.IMG_1.value.#image.value = ""; // encoded data

It works in Formcalc but doesnt work in JavaScript language.

Also, Is there a way to call/add Javascript function in Formcalc?

Can anyone please let me know what is missing and how to make it work?

Can we set URL[http://] to Image Object? How to set?

Adobe LiveCycle designer version : 11.0.9

Thanks,

Shridhar

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member546619
Discoverer
0 Kudos

Hello Pascal,

Thanks for your quick reply.

By setting the url in JS, image is coming on the output file.

Is there a built in function, where in given a file path [local or http], which will convert to BASE64DATA, which can be mapped to IMG_1.value.#image.value = base64_data. If not, is there an alternate option you can suggest.

Thanks,

Shridhar

PascalBremer
Advisor
Advisor
0 Kudos

Hi Shridhar,
in Adobe Forms you have 3 possibilities to add an image.

  • Statically

You can directly embed images in the form template via the designer.
Also like in the example you used above you can set the image data in JS and FormCalc.

FormCalc:

 $.value.#image.value = "BASE64DATA"

Javascript:

this.value["#image"].value = "BASE64DATA"

Note that # is not a valid property name in JS therefore you need to wrap it in brackets.

  • URL

You can assign the image url via scripting or statically in the form template via designer.
Make sure the Server where ADS is installed has access to the image url, otherwise image might not be retrieved correctly.

FormCalc:

 $.value.#image.href = "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/SAP-Logo.svg/320px-SAP-Logo.svg.png"

Javascript:

this.value["#image"].href = "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/SAP-Logo.svg/320px-SAP-Logo.svg.png"
  • Data XML (recommended)

In your data xml you can include your base64 encoded image and simply bind it to an image field via data binding.

-----------------------------------------------------------------------------------------------

Lastly for your question to combine FormCalc and Javascript, this is not possible as they use different parsers / compilers. But you can freely use FormCalc / Javascript for different fields.

Best regards
Pascal