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.
SOLVED

How to make items visible but inaccessible in a dropdown

Avatar

Level 2

I have dropdown1 with items1-3.  I have dropdown2 with items 1-10.  When item1 is selected in dropdown1 I want dropdown2 to display all 10 items but some items be inaccessible(faded out) and not selectable.

(example)

item1  =    [dropdown2] item 1 = selectable

                [dropdown2] item 2 = selectable

                [dropdown2] item 3 = selectable

                [dropdown2] item 4 = not selectable

                [dropdown2] item 5 = selectable

                [dropdown2] item 6 = not selectable

              

and so on.

I have coded dropdown2 to populate based on items selected from dropdown1 but the problem is the user needs to see options that are not available for selection?

I am very new to FormCalc & Java any help would be greatly appreciated!!  I am using LiveCycle Designer ES 8.2

1 Accepted Solution

Avatar

Correct answer by
Level 2

Thanks to your help I have got it working now.  I played around with your example here is your modified example of what I was trying to accomplish...https://dl.dropbox.com/u/12892158/Limit_DDL_Selection.pdf   Thank you for your help.

View solution in original post

7 Replies

Avatar

Level 10

Hi,

you can do this with a script in the change event of the drop down box.

It will check the boundItem against the notUsed regular expression.

This example won't allow the selectio of item 1, 3, 4 and 8.

var notUsed = /1|3|4|8/;

if (this.boundItem(xfa.event.change).match(notUsed)) {

          xfa.event.change = "";

}

Avatar

Level 2

Ok this may help me but I have a few issues.  When I apply specfy item values then my dropdowns do not populate.  So I have my values spelled out.  So with that my code for dropdown1 goes as follows in the change event.

case "LS32CS - CSA Approved Switch":

    DropDownList3.addItem("FLD - Field Config.")

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

My question is can I empliment your code within this "case" like?

case "LS32CS - CSA Approved Switch":

var notUsed = /DropDownList3.addItem("FLD - Field Config.")/;

if (this.boundItem(xfa.event.change).match(notUsed)) {
          xfa.event.change = "";
}

    DropDownList3.addItem("FLD - Field Config.")

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

Thanks,

Avatar

Level 2

Thanks for the example, but your form doesnt work?

Avatar

Level 2

Here is my entire code for DDL1.  In case "LS32CS - CSA Approved Switch": i do not want  DropDownList3.addItem("FLD - Field Config.") to be selectable??

DropDownList3.clearItems();

var sNewSel = this.boundItem(xfa.event.newText);

switch (sNewSel)

{

  case "VS5100 - Dual Channel VERSA-SWITCH":

    DropDownList3.addItem("FLD - Field Config.")

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

  case "VS51NX - Dual Channel Non Explosion Proof":

    DropDownList3.addItem("FLD - Field Config.")

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

   

  case "LS51SC - Single Channel Level Switch":

    DropDownList3.addItem("FLD - Field Config.")

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

  case "LS51NX - Single Channel Level Non Explosion Proof":

    DropDownList3.addItem("FLD - Field Config.")

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

   

  case "LS32CS - CSA Approved Switch":

          DropDownList3.addItem("FLD - Field Config.")

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

   

  case "LS32CN - CENELEC Approved Switch":

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

   

  case "LS32NX - Non Explosion Proof Switch":

    DropDownList3.addItem("110 - 110VAC")

    DropDownList3.addItem("220 - 220VAC")

    DropDownList3.addItem("24D - 24VDC")

    DropDownList3.addItem("24A - 24VAC")

    break;

   

  default:

    break;

}

Avatar

Correct answer by
Level 2

Thanks to your help I have got it working now.  I played around with your example here is your modified example of what I was trying to accomplish...https://dl.dropbox.com/u/12892158/Limit_DDL_Selection.pdf   Thank you for your help.

Avatar

Level 2

Lets take this a step further.  once an item has been selected in DD1 I want to make the Items that are not selectable in DD2  "faded out" or "watermarked".  Where would we insert the font.attributes?