cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding a Static image based on a condition.

former_member576008
Active Participant
0 Kudos

Hi,

Could you please let me know how to hide/Un hide a static image dynamically based on a criteria/condition.

Regards,

Nandha.

Accepted Solutions (1)

Accepted Solutions (1)

former_member576008
Active Participant
0 Kudos

Hi,

Thanks for your help/reply.

But I have a few clarifications.

1. what is the hidden textfield ( 'hiddenTextfield.rawValue " )in the example provided by you.Is it the text field name that is appering in the adobe form or can it be any variable in the context and which is not used in the form.

2.Do we need to bind the input field in the object property of the image field.

3.Is there a sepecific event in which the below code needs to be used.Because I tried with the below logic but did not work.

if ( hiddenTextfield.rawValue == 'AG' )

myImage.presence = "hidden";

else

myImage.presence = "visible";

Regards,

Nanda

chintan_virani
Active Contributor
0 Kudos

1. what is the hidden textfield ( 'hiddenTextfield.rawValue " )in the example provided by you.Is it the text field name that is appering in the adobe form or can it be any variable in the context and which is not used in the form.

That was an example. You need to write the name of the Field in your subform shown on Left hand side in LiveCycle designer.

2.Do we need to bind the input field in the object property of the image field.

There is no binding required. Binding is required for the condition/element you are checking. Lets assume the element is MASSG for which you already have the value when the form is initialized.

3.Is there a specific event in which the below code needs to be used.Because I tried with the below logic but did not work.

So now write the code using MASSG element and its conditinal values in if else format as mentioned earlier in form:ready or initialize event of the top level subform and also change the language to JavaScript.

Chintan

former_member576008
Active Participant
0 Kudos

Thanks Chintan.

But I have few clarification on this because I tried but did not work .

I have a text field with name 'ID' and the field is binded with the variable 'ID'.The text field 'ID' is inside a node and is used in the master page of the layout.The image field name is 'Image_Field'.I want to hide this image field based on the value in the text field 'ID'. The image field is used in the body page of the layout.

1.Please let me know if a need to place the above code in the event of the image field or in the event of the subform.

2.Do we need to bind the the variable ID in the object of the image field.

3.Do we need to uncheck the field "Embed Image Data".

4.The default vaue in the presence field is "Visible".Do we need to change this.

5.While checking the condition do we need to use the text field name or the variable name along with the node position.

6.Also please let me know if we need to make any extra setting for hiding the image.

The code which i tried was

if ( ID.rawValue == '123' )

Image_Field.presence = "hidden";

else

Image_Field.presence = "visible";

endif

Kindly provide me your valuable suggestions.Thanks in Advance.

chintan_virani
Active Contributor
0 Kudos

You can find my contact details in business card. Send me the Adobe form and I will take a look.

Chintan

Answers (1)

Answers (1)

Former Member
0 Kudos

You can use JavaScript, just write your check and then change the presence parameter of the image.

For example this will make your image invisible:

 if ( hiddenTextfield.rawValue == 'AG' )
   myImage.presence = "hidden"; 
else
   myImage.presence = "visible";

You could also use invisible, this is different as hidden since as invisible it will still take up space (according to its length and width), as hidden it will disappear completely.

Kr,

Frederik-Jan.