Print Page | Close Window

RadioButton. How?

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1884
Printed Date: 22 Nov 24 at 7:59PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: RadioButton. How?
Posted By: vizacc
Subject: RadioButton. How?
Date Posted: 11 Jul 11 at 11:25AM
I searched around -->

Here's a kb-article from Rowan how to read values from radiobuttons:
http://help.quickpdflibrary.com/questions/350/get-data-from-radio-button-form-fields
Try the knowledgebase of QuickPDF searching with "choice" and "radio button":
http://help.quickpdflibrary.com/

Site *http://help.quickpdflibrary.com/* not working. Can someone please post an example?





Replies:
Posted By: Rowan
Date Posted: 11 Jul 11 at 12:30PM
Here is the answer you are looking for:


Radio buttons that use the same title are considered to be part of a radio button group. Each radio button that belongs to the group is a child or sub-radio button.

This means that you can use the  http://www.quickpdflibrary.com/help/quickpdf/GetFormFieldTitle.php - GetFormFieldTitle  and  http://www.quickpdflibrary.com/help/quickpdf/GetFormFieldValue.php - GetFormFieldValue  functions to find out the title and selected value of a radio button group.

So for example, if you have a radio button group which has the title Nationality and this group has sub-radio buttons with the export values of AustralianFrenchGermanAmerican and Chinese, but the Australian sub-radio button is the radio button which is selected in the PDF form, then the GetFormFieldValue function will return a value of Australian for the Nationality radio button group.

The code for this would look something like the below:

// Loop through all of the form fields in the PDF
for i := 1 to QP.FormFieldCount do
begin
   
// Only process radio buttons
   
if QP.GetFormFieldType(i) = 4 then
   
begin
       
// Get radio button group title and selected value
       
WriteLn(IntToStr(i) + '. Group');
       
WriteLn;
       
WriteLn('Radio Button Group: ' + QP.GetFormFieldTitle(i));
       
WriteLn('Selected Radio Button Value: ' + QP.GetFormFieldValue(i));
       
Writeln;
   
end;
   
ReadLn;
end;

If you wanted to get the radio button group title, selected value and a full list of all the sub-radio buttons that belong to the radio button group, then you could do it like this:

// Loop through all of the form fields in the PDF
for i := 1 to QP.FormFieldCount do
begin
   
// Only process radio buttons
   
if QP.GetFormFieldType(i) = 4 then
   
begin
       
// Get radio button group title and selected value
       
WriteLn(IntToStr(i) + '. Group');
       
WriteLn;
       
WriteLn('Radio Button Group: ' + QP.GetFormFieldTitle(i));
       
WriteLn('Selected Radio Button Value: ' + QP.GetFormFieldValue(i));
       
Writeln;
       
end;
       
ReadLn;
       
end;

       
// Get all of the sub-radio buttons from the radio button group
       
WriteLn('Child Radio Buttons In This Group:');
       
WriteLn;
       
if QP.GetFormFieldKidCount(i) <> 0 then
       
for j := 2 to QP.GetFormFieldSubCount(i) do
       
begin
        s
:= QP.GetFormFieldSubTempIndex(i, j);
       
WriteLn(QP.GetFormFieldSubName(i, j));
       
end;
       
Writeln;
   
end;
   
ReadLn;
end;

These examples are written in Delphi and use a console application, however, they should be fairly easy to understand for any programmer and can easily be adjusted to work with a GUI application. If you experience any problems, please leave a comment.



Posted By: vizacc
Date Posted: 11 Jul 11 at 12:31PM
Rowan, thank you :)


Posted By: vizacc
Date Posted: 11 Jul 11 at 12:35PM
do you know how to create a radio button?



Posted By: vizacc
Date Posted: 11 Jul 11 at 12:40PM

http://help.quickpdflibrary.com/questions/213/create-radiobuttons - Create Radiobuttons - Quick PDF Library Knowledge Exchange

Can you please provide the post for this


Posted By: vizacc
Date Posted: 12 Jul 11 at 3:40AM
a heads up. now the help site is working :) danke danke



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk