Change export value based on text field

Community Beginner ,
Sep 20, 2018 Sep 20, 2018

Copy link to clipboard

Copied

I want to have a drop-down's export value change depending on a text field. Is there a way to do that?

Thanks

-Austin

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

183

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 ,
Sep 20, 2018 Sep 20, 2018

Copy link to clipboard

Copied

Yes, here is an article on programming list/dropdown fields

https://acrobatusers.com/tutorials/list_and_combo_in_lc

However, this may not be a very practical solution.  What is it that you are trying to do? 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Beginner ,
Sep 20, 2018 Sep 20, 2018

Copy link to clipboard

Copied

What I am trying to do is when you enter your email in a form a the end of the PDF there is a submit button and drop-down list that emails based on the selection. And this would get the email that you entered and sticks it into one of the export values of one of the selections on the drop down list.

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 ,
Sep 20, 2018 Sep 20, 2018

Copy link to clipboard

Copied

So you want to add entries to a list?  Or change the export value of an existing entry?

The article I linked provides a perfect example for adding emails to a list.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Beginner ,
Sep 20, 2018 Sep 20, 2018

Copy link to clipboard

Copied

Change export value of an existing entry.

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 ,
Sep 20, 2018 Sep 20, 2018

Copy link to clipboard

Copied

There is no single function for setting a list item value, so assuming the item index is known, the script will need to acquire the current item "Name", delete the item, and then insert the new item using the acquired name and index.

Here's an example, it replaced the export value of the currently selected item.  The script is written for a button. You should run it first from the console window to make sure it works.

var cNewVal = this.getField("TextField").valueAsString();

var oListField = this.getField("ListField");

if(oNewValue.length)

{

    var nIdx = oListField.currentValueIndices[0];

    var strName = oListField.getItemAt(nIdx,false);

    oListField.deleteItemAt(nIdx);

     oListField.insertItemAt(strName,cNewVal,nIdx);

}

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Beginner ,
Sep 25, 2018 Sep 25, 2018

Copy link to clipboard

Copied

LATEST

I'm not sure if i understand this. I am very new to adobe and coding.

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