Skip to main content
Participant
Mar 20, 2020 6:10 PM UTC
Answered

Use VBA to get a dropdown list value

Hello All,

I am using the JSO object and get field method to retrieve the values of dropdown lists from a form and place them into a variable which is then placed in a spreadsheet. In the following code the mobjJSO has already been initialized.  The value of the array is the name of the dropdown list  that is Skill_1.  I have confirmed the name and that it is on the PDF form.  I have other dropdowns that this appears to work correctly to bring back the value, but for this one I actually get the number of item that was chosen in the listing instead of the text.  For instance, if the user chose Data Entry below returns a 2 for the second item in the list instead of "Data Entry".  Does anybody know what I am doing wrong?  I just can't seem to get this to work.  

strValue = mobjJSO.getField(mobjLookupArray(i, 0)).Value  

Thank you!

Thayana

This topic is closed to new replies. Start a new post to keep the conversation going.
Thom Parker
Thom ParkerCorrect answer
Community Expert
Mar 24, 2020 2:16 AM UTC

Did you check the export values in the list?  This is what is returned as the value of the list field. 

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

2 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
Mar 24, 2020 2:16 AM UTC

Did you check the export values in the list?  This is what is returned as the value of the list field. 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
ThayanaAuthor
Participant
Mar 25, 2020 12:41 PM UTC

Thanks! That was it.

Translate