Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


DROPDOWN CUSTOM KEYSTROKE NO ACCEPTING SCRIPT THAT WOULD DETERMINE VALUE IN ANOTHER DROPDOWN

Explorer ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

The subject matter i believe is self explanatory. I cant figure out where I'm going wrong. Below is the script.

var Itemlist = this.getField("Van loan list");
if(event.willCommit)
{
switch(event.value) {

case "NORTH":
Itemlist.setItems(["-SELECT-", "PAT-SONNY NIGERIA ENTERPRISES", "EVANS MAC BUSINESS VENTURES LTD", "HAYAT INTERGRATED SERVICES LIMITED (Abuja)", "HAYAT INTERGRATED SERVICES LIMITED (Kaduna)", "HAYAT INTERGRATED SERVICES LIMITED (Nasarawa)", "HAYAT INTERGRATED SERVICES LIMITED (Kogi)", "CELPLANET INTERNATIONAL LIMITED", "AJELIELI AND SONS LIMITED", "ALH AMINU MUHAMMED ACHIDA AND SONS", "BALARABE USMAN ENTERPRISES", "ABDULLAHI MAI SOLAR", "HAMIR INVESTMENT NIG. LTD", "SUFAYE INVESTMENT LIMITED", "MAZAFMINI DEPOT STORES LTD", "SHARUBUTU AND SONS NIGERIA LIMITED", "TABAKO LIMITED", "ALH SANUSI SODANGI & SONS", "ALHAJI ABU ZAMAU ENTERPRISES", "ALH. IBRAHIM USMAN ACHIDA & SONS LIMITED", "NASMAM ENTERPRISES", "ALH ALIYU AHMAD DANFULANI INTERNATIONAL LIMITED", "HAMED BUKAR GLOBAL LTD", "BABAGANA AIMA ENTERPRISES", "NAHEEM HEIGHTS LIMITED", "A. D. BASHARU AND SONS (NIGERIA) LIMITED", "SAN HUSEIN NIG. LTD", "HAMAZ COMMUNICATIONS NIGERIA LIMITED", "A.A. SULEIMAN NIGERIA LIMITED", ]);
Price.value = "";
break;

case "SOUTH":
Itemlist.setItems(["-SELECT-", "ALHAJA KOLAWOLE NIGERIA ENTERPRISES", "DAM-LIZZY VENTURES", "HAPPY PLACE INTERNATIONAL", "ALHAJA KEBE ASIBUNALAU AND COMPANY", "WATERGATE PRODUCTS SERVICES LIMITED", "CHRISLANDBOLU GENERAL TRADING AND ENGINEERING SERVICES LIMITED", "BENEKS PHARMACEUTICAL LIMITED", "LESCENT VENTURES LTD", "TRADEDEPOT LIMITED", "MULTI QUEST", "ABT EPHPHATHA LIMITED", "KPD MERCHANDISE LIMITED", "FAMOUS ECKCCO LIMITED", "W. J. UKAONU & SONS NIG LTD", "DON EKESINO INVESTMENT LIMITED", "FELIX C. UFONDU NIG. ENTS", "ONYESCO INVESTMENT LIMITED", "P. K. ENTERPRISES.", "E. C. ILOABUCHI AND SONS TRADING CO. NIG.", "A. M. OBI & SONS", "CHUDAC BROTHERS NIGERIA", "SUNEST INTEGRATED RESOURCES", "ZITONIA INTEGRATED VENTURES LIMITED", "OTOSI NIGERIA ENTERPRISES", "BUFFALO WORKS LIMITED", "AKUCHI STORES", "REGENT VENTURES", "AUGUSTINE UCHE NIGERIA ENTERPRISES", "ANOKE SJ NIGERIA LTD", "KOJIDAM NIGERIA LIMITED", "ISANGETTE INTERNATIONAL", "MERTESACKER NIG LTD", "HABSOD VENTURES", "ISIAKA AGBOLUAJE NIG ENTERPRISES", "ADESIJI N. VENTURES", "GOF. COMMERCIAL ENTERPRISES.", "OMO-FADE VENTURES", "JOPEEM VENTURES", "MOYIN OLUWA TRADING STORES", "AYOOLAYINKA ENTERPRISES", "FUMBOL GLORY VENTURES" ]);
Price.value = "";
break;

default:
Itemlist.setItems([""]);
Price.value = "";
break;


}

}

 

Someone should kindly help with this ASAP.

Thanks in advance.

Views

165

Likes

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

correct answers 3 Correct answers

Adobe Community Professional , Aug 20, 2021 Aug 20, 2021
To correct myself, it's not a necessity to set clearItems() on each case but you can still use it at default if you don't want blank choice when you click on field. Read try67 post he explained why script disappear, but script should still work. The problem is this word "MAZAFMINI" try use it like this MAZA\FMINI line won't show in items and script should be visible. You can delete lines that include Price. UPDATE: You should put script in "Custom Keystroke Script"

Likes

Translate

Translate
Adobe Community Professional , Aug 23, 2021 Aug 23, 2021
If you don't know how to add Document script, read this otherwise skip this part: While in 'Prepare form' tool, press SHIFT+D or click on 'More'->Document JavaScript. Now to add script: Name your script and click 'add' now when new window opens there will be function with name you just added (for this example Il call it droplist), script in that window will look like this: function droplist(){} put your script (the one you posted in your first post) between those curly brackets: function droplis...

Likes

Translate

Translate
Explorer , Aug 23, 2021 Aug 23, 2021
Thanks a lot. it worked.

Likes

Translate

Translate
Adobe Community Professional ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Hi

Can you tell us which Adobe application you're using so we can move the thread to the correct forum

Likes

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Acrobat DC.

Thanks a lot.

Likes

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
Adobe Community Professional ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Moving.

Likes

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
Adobe Community Professional ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Where do you call Price variable?

Add clearItems() to each case so it clears items before setting new ones and set same for default instead of

Itemlist.setItems([""]);

use this:

Itemlist.clearItems();

Likes

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

I'm really a novice to this. I copied this script from some other form that has something to also do with price. What I'm using it don't have field. The drop-down functionality is what I cared about. Meanwhile I did what you adviceme to do  and its still the same result.

Thanks

Likes

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
Adobe Community Professional ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

To correct myself, it's not a necessity to set clearItems() on each case but you can still use it at default if you don't want blank choice when you click on field.

Read try67 post he explained why script disappear, but script should still work.

The problem is this word "MAZAFMINI" try use it like this MAZA\FMINI line won't show in items and script should be visible.

You can delete lines that include Price.

UPDATE:

You should put script in "Custom Keystroke Script"

tempsnip.png

Likes

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Wow!

It worked. Thanks a lot. One more question pls. How do I add a Cc in my submit button property. Thanks.

Likes

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
Adobe Community Professional ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Because your script contains the string "AF" Acrobat will hide it after you apply it (as that's used for its internal functions). However, it should still work!

Likes

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

the above suggestion did not work.

Likes

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

An example would really help.

Thanks

Likes

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
Adobe Community Professional ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

It was not a suggestion. I was just pointing out why it's happening. You can solve it by moving the code to a function in a doc-level script and then just call it from the field.

Likes

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 ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

I understand now. thanks.

I would love to learn that. What code would use to call it?

Likes

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
Adobe Community Professional ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

If you define a function called myFunction1, for example, then you call it like this:

myFunction1();

Likes

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 ,
Aug 23, 2021 Aug 23, 2021

Copy link to clipboard

Copied

 Okey!!!

But how do I call it, and what script am I to use to call it from the document script.

Thanks.

Likes

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
Adobe Community Professional ,
Aug 23, 2021 Aug 23, 2021

Copy link to clipboard

Copied

If you don't know how to add Document script, read this otherwise skip this part:
While in 'Prepare form' tool, press SHIFT+D or click on 'More'->Document JavaScript.

Now to add script:
Name your script and click 'add' now when new window opens there will be function with name you just added (for this example Il call it droplist),
script in that window will look like this: function droplist(){}

put your script (the one you posted in your first post) between those curly brackets:
function droplist(){put script here}
Now go to your dropdown field ( the one where you want the script to work) go to format tab->select 'custom' and add your function name to 'Custom keystroke script'
like this:
droplist()

Likes

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 ,
Aug 23, 2021 Aug 23, 2021

Copy link to clipboard

Copied

LATEST

Thanks a lot. it worked.

Likes

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