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

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 , Windows

Views

388

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 ,
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

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

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 ,
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

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

Copy link to clipboard

Copied

Change export value of an existing entry.

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 ,
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

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

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