Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Dynamically setting image field href

Avatar

Level 1

I'm trying to dynamically set an image field on my LiveCycle PDF form. On my form onReady function I have some Javascript code that is executing. For some reason, if I explicity set my image field to a string value, everything works. However, if I try to dynamically set it using a value from a text input, it doesn't work.

Any ideas? I've used app.alert to make sure that the value in the textfield is correct.

//Try to set image field to a string value. [WORKS]

swatch1.image.value.image.href = "http://localhost/qs/images/waterswatch.png";

//Alert Value of text field (Result: http://localhost/qs/images/waterswatch.png )

app.alert(swatch1.imgPath.rawValue)

//Try to set image field dynamically. [DOESNT WORK]


swatch1.image.value.image.href = swatch1.imgPath.rawValue;



3 Replies

Avatar

Level 10

Hi,

the href property cannot be set dynamically to load external images.

This will only work for already embedded images.

Avatar

Level 1

I am able to set my image field using the code below. Isn't that dynamic in the fact that it is not embedded in the LiveCycle template? All i want to do is replace that string value with the text attribute of a textfield.

//Try to set image field to a string value. [WORKS]

swatch1.image.value.image.href = "http://localhost/qs/images/waterswatch.png";

If what you say is correct, how would you pass images into a LiveCycle form from ColdFusion or any other programming language?