• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dropdown selection filters two additional dropdowns

Explorer ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

I am attempting to have one list filter the possible selections for two different dropdownlists

I have the first one right but I can't seem to get the second list to work. Here is the JS I am using.

// This is used to Populate the G/L Account dropdown list base on the Location selection

//

switch (event.value) {

    case "- Select One -":

        this.getField("G/L Account").setItems(["-----"]);

        break;

    case "Cape":

        this.getField("G/L Account").setItems(["- Select One –", "22258 CAPE GENERAL FUND G/A -", "22259 CAPE GENERAL FUND UFM -",

        "22260 CAPE DIRECTOR G/A -", "22261 CAPE DIRECTOR UFM -", "22262 CAPE ACCOUNTING G/A -", "22263 CAPE PERSONNEL G/A -", "22264 CAPE MARKETING G/A -", "22265 CAPE MARKETING UFM -", "22266 CAPE GREEN HOUSE G/A -", "22267 CAPE GREEN HOUSE FOOD -", "22268 CAPE GREEN HOUSE BAR -", "22269 CAPE GREEN HOUSE RESALE -", "20764 CAPE COMM REC G/A -", "20765 CAPE COMM REC UFM -", "21914 CAPE COMM REC PROGRAM -", "21940 CAPE COMM REC MERCH RESALE -", "22284 CAPE UNIT ALLOCATIONS G/A -", "22274 CAPE DEPLOYED FORCES G/A -", "22275 CAPE DEPLOYED FORCES PROGRAM -", "22276 CAPE DEPLOYED FORCES UFM -", "21582 CAPE FITNESS G/A -", "21583 CAPE FITNESS UFM -", "21643 CAPE FITNESS PROG -"]);

        break;

case "Jacksonville":

        this.getField("G/L Account").setItems(["- Select One –","84 JAX GENERAL FUND G/A -","85 JAX DIRECTOR G/A -","86 JAX ACCOUNTING G/A -","87 JAX PERSONNEL G/A -","89 JAX MARKETING G/A -","90 JAX MAINTENANCE G/A -","1107 JAX NFC -","8802 JAX GENERAL FUND UFM -","22000 JAX MARKETING UFM -","22001 JAX MAINTENANCE UFM -","19112 JAX SE REGIONAL GRANTS -","91 JAX DEWEY'S G/A -","94 JAX DEWEY'S FOOD -","130 JAX BINGO PROGRAM -","976 JAX DEWEY'S BAR -","22002 JAX CONF/CATERING G/A -","22003 JAX CONF/CATERING FOOD -","22004 JAX CONF/CATERING BAR -","21662 JAX CONF/CATERING PROGRAM -","20774 JAX COMM REC G/A -","20775 JAX COMM REC UFM -","21919 JAX COMM REC PROGRAM -","21947 JAX COMM REC MERCH RESALE -","102 JAX PICNIC/PARKS G/A -","103 JAX PICNIC/PARKS PROGRAM -","8803 JAX PICNIC/PARKS UFM -","22006 JAX SE REGIONAL GRANTS G/A -","22007 JAX SPECIAL COMMUNITY EVENTS G/A -","22008 JAX SPECIAL COMMUNITY EVENTS PROG -","22009 JAX SPECIAL COMMUNITY EVENTS UFM -","77 JAX COMMUNITY PROGRAM G/A -","78 JAX COMMUNITY PRG PROGRAM -","22010 JAX COMMUNITY PRG UFM -","8806 JAX COMMUNITY ACTIVITIES UFM -","22011 JAX COMMUNITY ACTIVITIES G/A -","149 JAX TICKETS G/A -","150 JAX TICKETS ENT PROGRAM -","151 JAX TICKETS TOURS PROGRAM -","1094 JAX TICKETS RESALE -","8813 JAX TICKETS UFM -","924 JAX UNIT ALLOCATIONS -","23972 JAX CAMPSITES CAT C G/A -","23973 JAX CAMPSITES CAT C PROGRAM -","104 JAX RV PARKS G/A -","105 JAX RV PARKS PROGRAM -","1257 JAX COTTAGES/CABINS G/A -","1258 JAX COTTAGES/CABINS PROGRAM -","108 JAX LIBERTY G/A -","109 JAX LIBERTY PROGRAM -","8805 JAX LIBERTY UFM -","24146 JAX VEHICLE STORAGE PROG -","121 JAX CARWASH G/A -","123 JAX CARWASH PROGRAM -","124 JAX AUTO SKILLS G/A -","126 JAX AUTO SKILLS PROGRAM -","8811 JAX AUTO SKILLS UFM -","21661 JAX AUTO SKILLS RESALE -","79 JAX MARINA CAT B G/A -","80 JAX MARINA CAT B PROGRAM -","8812 JAX MARINA CAT B UFM -","81 JAX MARINA CAT C GAS G/A -","127 JAX MARINA CAT C G/A -","128 JAX MARINA CAT C RESALE -","129 JAX MARINA CAT C BOAT BERTHING PROG -","131 JAX MARINA CAT C BOAT STORAGE PROG -","22015 JAX MARINA CAT C PROGRAM -","22070 JAX MARINA CAT C GAS OTH RESALE -","132 JAX GOLF RESALE -","133 JAX GOLF PROGRAM -","134 JAX GOLF MAINTENANCE PROGRAM -","136 JAX GOLF CART RENTAL -","137 JAX GOLF DRIVING RANGE PROGRAM -","138 JAX GOLF G/A -","168 JAX GOLF BAR -","169 JAX GOLF FOOD -","140 JAX BOWLING RESALE -","141 JAX BOWLING PROGRAM -","142 JAX BOWLING G/A -","143 JAX BOWLING FOOD -","144 JAX BOWLING BAR -","21663 JAX BOWLING RENTAL -","21664 JAX BOWLING AMUSEMENT -","12130 JAX AQUATICS FITNESS G/A -","12131 JAX AQUATICS FITNESS OTHER F&B -","12132 JAX AQUATICS FITNESS PROGRAM -","12133 JAX AQUATICS FITNESS UFM -","152 JAX RECYCLING G/A -","153 JAX RECYCLING PROGRAM -","22016 JAX FITNESS CONDITIONING G/A -","22017 JAX FITNESS CONDITIONING PROGRAM -","22018 JAX FITNESS CONDITIONING UFM -","8816 JAX FITNESS CENTER UFM -","22019 JAX FITNESS CENTER G/A -","22020 JAX FITNESS CENTER RESALE -","22021 JAX FITNESS CENTER PROGRAM -","159 JAX INTRAMURAL SPORTS G/A -","160 JAX INTRAMURAL SPORTS PROGRAM -","773 JAX INTRAMURAL SPORTS OTHER F&B -","8817 JAX INTRAMURAL SPORTS UFM -","164 JAX OPEN HOUSE EVENTS G/A -","165 JAX OPEN HOUSE EVENTS PROGRAM -","114 JAX CDC G/A -","117 JAX CDC PROGRAM -","8809 JAX CDC UFM -","22022 JAX CDC VPK PROGRAM -","116 JAX CDH PROGRAM -","1276 JAX CDH G/A -","8810 JAX CDH UFM -","110 JAX YOUTH G/A -","111 JAX YOUTH SUNDRIES -","112 JAX YOUTH PROGRAM -","8807 JAX YOUTH UFM -","16127 JAX YOUTH SLO NON UFM -","20723 JAX YOUTH SLO UFM -","21764 JAX TEEN EMPLOYMENT UFM -","113 JAX SAC PROGRAM -","8808 JAX SAC UFM -","19496 JAX SAC G/A -"]);

       }

// This is used to Populate the Site dropdown also base on the Location selection.

if (this.getField("Installation").value == "Cape") this.getField("Site").setItems([" ", "1", "2"])

else if (this.getField("Installation").value == "Jacksonville") this.getField("Site").setItems([" ", "3", "4"])

TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

Just add the code into your existing switch command, before the break statements in each case.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

That sounds easy, but I am new at this and not really sure where to put the code.  I need a little bit more direction please.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

switch (event.value) {

    case "- Select One -":

        this.getField("G/L Account").setItems(["-----"]);

        this.getField("Site").setItems(["-----"]);

        break;

    case "Cape":

        this.getField("G/L Account").setItems([ ... ]);

        this.getField("Site").setItems([" ", "1", "2"])

        break;

    case "Jacksonville":

        this.getField("G/L Account").setItems([ ... ]);

        this.getField("Site").setItems([" ", "3", "4"]);

        break;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

I think I have this thing screwed up. Should all the code go in the location field?  When I added the code it replaced the location with the Site data? 

I have three fields/lists     1. Has locations   Jacksonville, Cape, NOLA

                                         2. Has the G/L accounts

                                        3.  Has Site Numbers

I want to Select a location in list one.

That selection filters list two and three all are in different fields.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

Yes, it needs to go as the custom validation script of the Location field. Why do you think it's screwed up? What's not working correctly?

Are you seeing any error messages in the JS Console?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

Its JS is working with no errors, just not what I wanted it to do.

I have the JS in the Location field and in Custom validation script.

When I selected a location "Cape" it changed the dropdown list to the available Site values?

I want to keep the location selection "Cape" and have the values available in the Site field to select.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

I don't follow... I thought you wanted to change both fields.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

I want to change the location field " Cape" and have the other fields G/L Account is working the Site Number Field is not. I need it to also filter based on the location selection. Keeping the location field . The picture might help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

Hopfully the picture makes it a little bit clearer, thank you for taking the time to help .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

I'm sorry, but your description is not very clear to me...

Is the field on top "Installation", and the other two "G/L Account" and "Site"? Don't you want to set the values of the latter two fields based on the selection in the first one?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

Yes, the top field is Installation and the other two are G/L Account and Site

I have a list of 1000 site numbers and 1200 G/L Accounts

They need to be filtered based on the Installation location

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

OK... So what's the problem with the code I provided, exactly?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

When I added the JS it changed the Location text to the Site dropdown list

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

Post your full code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

The good news,I was able to get it working correctly.  The bad news is I seem to have to many lines of text?

Adobe keeps cutting the JS is there a limit for text and if there is is there a work around?  Any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

What do you mean by "cutting the JS".  If part of the code is missing, how can it be working fine?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 14, 2018 Jun 14, 2018

Copy link to clipboard

Copied

LATEST

Thank you try67 as always you provided correct code.

switch (event.value) { 

    case "- Select One -": 

        this.getField("G/L Account").setItems(["-----"]); 

        this.getField("Site Number").setItems(["-----"]); 

        break; 

    case "Cape Canaveral": 

        this.getField("G/L Account").setItems([ ... ]); 

        this.getField("Site Number").setItems([" ", "1", "2"]) 

        break; 

    case "NAS Jacksonville": 

        this.getField("G/L Account").setItems([ ... ]); 

        this.getField("Site Number").setItems([" ", "3", "4"]); 

        break; 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines