Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Drop down selection to make an image field visible

Avatar

Former Community Member

I Am using a drop down list: with clients names that upon specific choice from list I want to make a image field visible.

Drop Down has:

Client A

Client B

Image 1 is above the drop down list, Image 2, Image 3 are below the Drop down list and all images are set to visibile

I would like to have CLient A chosen and picture in Image1, 2, and 3 become visible otherwise they remain invisible.

I am completely lost I have tried a number of codes and java but I am clearly doing everything wrong.

Can we start basic please?

Should I use Java or FOrmcalc

On what type of even? ...

SIde note this Drop down list is already linked to a number of other fields where it auto populates them with the following code:

switch(this.rawValue){

    case "":
        form1.Page1.ClientPatientCoordinator.rawValue = "";
        form1.Page1.ClientPhone.rawValue = "";
        form1.Page1.ClientFax.rawValue = "";
        form1.Page1.ClientEmail.rawValue = "";
        break;

with Javascript on Exit at Client:

And is working great now thanks for everyones help...

3 Replies

Avatar

Level 10

You can use the Exit event of the dropdown and check for the rawValue..

I am using Java Script as the language in this example.

     switch(this.rawValue){

          case "A":

               Picture1.presence = "visible";

               Picture2.presence = "visible";

               Picture3.presence = "visible";

          case "B":

               Picture1.presence = "invisible";

               Picture2.presence = "invisible";

               Picture3.presence = "invisible";

     }

         

You need to make sure you have given the values to dropdown options.. Value for option "Client A" is set to "A" and similarly for "Client B" is set to "B".

Thanks

Srini

Avatar

Former Community Member

The attached uses a drop-down to drive the display of embedded images.

// form1.page1.dd::exit - (JavaScript, client)


if (this.rawValue != null) {

  var selection = this.rawValue;

  switch (selection) {

    case "image 1":

      form1.page1.imagePlaceHolder.rawValue =  xfa.resolveNode("form1.page1.image1.value.image").value;

      break;

    case "image 2":

      form1.page1.imagePlaceHolder.rawValue = xfa.resolveNode("form1.page1.image2.value.image").value;

      break;

    default:

      break;

  }

}

Steve

Avatar

Level 1

I realize that I'm being a bit dense on this, but where are the images that the attached form was pulling from? This does what I'm trying to do, but I'm not sure where to put my images.

Thanks!

-Caiti