Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

How To Get Selected Value From Drop Down List?

Question

There seems to be a wealth of information about how getting the selected value from a drop down list is 'heavy lifting' and apparently not easy, which is nice to know, but completely unhelpful. See this link:

http://www.quickpdf.org/forum/accessing-dropdown-choice-value-help_topic1475.html

GetFormFieldValue doesn't return anything for drop down lists, from what I have experienced. The million dollar question: how do you get the selected value from a drop down list!? A code example would be great.

I am using the ActiveX component of version 7.23. Like others, I am determining if this product is feasible for my project and without having this ability I may not be able to move forward with this.

Answer

Here is some code to get the Export value of the currently selected choice field.

Let us know if you have any problems with this code you can always send your code and your PDF to http://www.quickpdflibrary.com/support/support-query.php.

int ret = QP.LoadFromFile("applespearspeaches.pdf");
int fieldCount = QP.FormFieldCount();

for (int i = 1; i <= fieldCount; i++)
{
string title = QP.GetFormFieldTitle(i);
int type = QP.GetFormFieldType(i);

// For choice fields this return the 
// "exported value" of the currently selected item
string result = QP.GetFormFieldValue(i);  

MessageBox.Show(title + " = " + result);
}

© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum