Pull down menu option in Acrobat DC

New Here ,
Oct 27, 2017

Copy link to clipboard

Copied

I'm creating a form that will use pull down menus with basic choices to start. I will have the box checked to let the user enter custom text. Is there a way to have that custom entry automatically add itself to the existing pull down menu items so that it is available as an additional choice to the user the next time they fill that field out?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

131

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

Pull down menu option in Acrobat DC

New Here ,
Oct 27, 2017

Copy link to clipboard

Copied

I'm creating a form that will use pull down menus with basic choices to start. I will have the box checked to let the user enter custom text. Is there a way to have that custom entry automatically add itself to the existing pull down menu items so that it is available as an additional choice to the user the next time they fill that field out?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

132

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
Oct 27, 2017 0
Guide ,
Oct 29, 2017

Copy link to clipboard

Copied

I believe this can only be done through Scripting.

  • It's possible to set-up a dropdown menu so that someone can enter their own text. However this text is NOT automatically added to the dropdown menu options:
    dropdown-menu.png

I'm moving this post to the Scripting forum to see if someone else is able to answer this question for you.

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
Reply
Loading...
Oct 29, 2017 0
try67 LATEST
Most Valuable Participant ,
Oct 30, 2017

Copy link to clipboard

Copied

Make sure to tick the "Allow user to enter custom text" box, as mentioned by Cari, as well as the "Commit select value immediately" box, (shown in the same screenshot), and then apply the following code as the field's custom validation script:

if (event.value) {

    var found = false;

    for (var i=0; i<event.target.numItems; i++) {

        if (event.value==event.target.getItemAt(i)) {

            found = true;

            break;

        }

    }

    if (!found) event.target.insertItemAt({nIdx: event.target.numItems, cName: event.value});

}

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
Reply
Loading...
Oct 30, 2017 0