Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Setting check box subfield values |
Post Reply |
Author | |
Revolution1200
Beginner Joined: 26 May 11 Location: Glasgow Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 06 Jul 11 at 7:36PM |
Cheers Andrew,
That is very similar to what I ended up doing!
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Here is some code I use to display the possible sub field values required for setting check box and radio boxes.
for (int i = 1; i <= QP.FormFieldCount(); i++) { string title = QP.GetFormFieldTitle(i); string hint = QP.GetFormFieldDescription(i); string s = QP.GetFormFieldValue(i); int type = QP.GetFormFieldType(i); if (type == 3 || type == 4) // Radio or CheckBox { int sc = QP.GetFormFieldSubCount(i); for (int j = 1; j <= sc; j++) { string sfn = QP.GetFormFieldSubName(i, j); textBox1.AppendText(sfn); if (j != sc) textBox1.AppendText("|"); } } |
|
Revolution1200
Beginner Joined: 26 May 11 Location: Glasgow Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Hi Rowan,
Thanks for your reply, was pulled of the project for a week or so and this is the first chance I have had to get back to it!!
Finally found out that the sub field names are in actual fact the values I need to send to turn then checkbox on - for instance under the question for Sex, there are 2 sub fields Male and Female, to check the Male check, I use PDFLibrary.SetFormFieldValue PDFLibrary.FindFormFieldByTitle("partc q5"), "male"
Slightly confusing but got there in the end!!
Cheers
Stuart
|
|
Rowan
Moderator Group Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
|
Hi Stuart,
Can you try using "Yes" with SetFormFieldValue instead of "On"? PDFLibrary.SetFormFieldValue(subFieldIndex, "Yes") I did a quick test and Yes works for me but On does not. Cheers, - Rowan.
|
|
Revolution1200
Beginner Joined: 26 May 11 Location: Glasgow Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Hi Folks,
I am currently reviewing QuickPDF for our company, we are looking to automatically fill in H&S forms. For some reason I am unable to set the value of any of the check boxes on the form. I have been using the following code to confirm the subfields within VB6 For loopcounter = 1 To PDFLibrary.FormFieldCount currentFieldName = PDFLibrary.GetFormFieldTitle(loopcounter) If PDFLibrary.GetFormFieldType(loopcounter) = 4 Then If PDFLibrary.GetFormFieldKidCount(loopcounter) > 1 Then Debug.Print PDFLibrary.GetFormFieldKidCount(loopcounter) For subCounter = 2 To PDFLibrary.GetFormFieldKidCount(loopcounter) + 1 subFieldIndex = PDFLibrary.GetFormFieldSubTempIndex(loopcounter, subCounter) subFieldName = PDFLibrary.GetFormFieldSubName(loopcounter, subCounter) PDFLibrary.SetFormFieldValue(subFieldIndex, "On" Next End If End If Next I get a valid sub field index, and I can use this to verify that the subfield default value is "Off", I can also use the index to confirm that the subfield is of type 4 for a check box, however when I use the same value to try and set the field using PDFLibrary.SetFormFieldValue(subFieldIndex, "On") I get a return value of 0 which seems to mean the library cannot find the field specified? Is anyone able to share some code where this works? Kind Regards Stuart |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store