Expand my Community achievements bar.

Hiding and Showing Tables with Drop Down Menu

Avatar

Level 1

Im trying to learn how to hide and unhide tables/subforms using the selection from a drop down menu. Here is the code I was using attached to the drop down menu which I pulled from a previous post...but when I open the PDF and make a selection in the drop down menu I get a validation error message:

The value you entered for Drop-down List is invalid.

If you click OK it still unhides the table you selected in drop down. How do you edit the following to stop the error messages from popping up when a user makes a selection.

Here is the code I was using:

form1.Test1.DropDownList1::validate - (JavaScript, client)

//Firsthideallfields

form1.Test1.YES.presence="hidden";

form1.Test1.NO.presence="hidden";

//Thentheifstatement

if(this.rawValue=="Yes"){

form1.Test1.YES.presence="visible";

}

else if(this.rawValue=="No"){

form1.Test1.NO.presence="visible";

}

Sample.PNG

The above image is a sample of what I have using Adobe LiveCycle to develop. I basically have a DropDownList which has the option Yes or No. And then I have 2 subForms

YES - Table and info needed

NO - Table and info needed

As I mentioned using the code provided in this earlier post I have this working but I just have an error message popping up.

**** We did find a solution but don't know if it will cause other problems later or why we were getting the error in the first place. Adding:

Adding:

this.disableAll;

At the end of the script....we don't get any error messages but again if anyone can explain why the messages were popping up to begin with that would be great.

Any help would be great.

Cheers,

D

1 Reply

Avatar

Level 10

Hi,

use a script in the exit event instead of the validation event.

switch (this.rawValue) {

  case "Yes" :

  YES.presence = "visible";

  NO.presence = "hidden";

  break;

  case "No" :

  YES.presence = "hidden";

  NO.presence = "visible";

  break;

  default :

  YES.presence = "hidden";

  NO.presence = "hidden";

}

You also shoud set the presence of the subforms initially to hidden.