logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
brettr  
#1 Posted : Monday, November 14, 2016 2:44:34 PM(UTC)
brettr

Rank: Member

Groups: Registered
Joined: 8/11/2016(UTC)
Posts: 14
United States

Thanks: 1 times
A search on the forum for "radio" didn't turn up anything.

I have 4 radio buttons named RadioGroupZ. The related choices are 0, 1, 2, 4. I'd like to tick one of these. Can you show how that is done through InterForm?

_doc = Patagames.Pdf.Net.PdfDocument.Load("...", new PdfForms());
var interactiveForms = _doc.FormFill.InterForm;
foreach (var field in interactive.Forms)
{
//condition finds radiobutton
//how to tick one radio within group?
}

Thanks.
Paul Rayman  
#2 Posted : Monday, November 14, 2016 8:05:25 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Code:

_doc = Patagames.Pdf.Net.PdfDocument.Load("...", new PdfForms());
var interactiveForms = _doc.FormFill.InterForm;
foreach (var field in interactive.Forms) 
{
   //condition finds radiobutton
   //how to tick one radio within group?
   if (field.FieldType == FormFieldTypes.FPDF_FORMFIELD_RADIOBUTTON)
      field.CheckControl(3, true); //3 - for example - it is an index of radiobutton control in radibutton's group
}
brettr  
#3 Posted : Thursday, November 17, 2016 1:47:42 PM(UTC)
brettr

Rank: Member

Groups: Registered
Joined: 8/11/2016(UTC)
Posts: 14
United States

Thanks: 1 times
Thanks.

I have another scenario in which the grouped values are letters. I find the specific radio within the group by matching its option value. I want to tick it but nothing happens. Here is my code:

Code:

foreach (var item in field.Controls)
{
  if(item.ExportValue == someOptionValue)
   {
     field.Value = "On";
    }
}


Where field is one of the grouped radios. Line 5 does execute. Do you know what I'm doing wrong?

I'm running into the same issue with checkboxes.

Edited by user Thursday, November 17, 2016 2:53:23 PM(UTC)  | Reason: Not specified

Paul Rayman  
#4 Posted : Monday, November 28, 2016 5:02:01 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
I'm guessing after modifying the page's dictionary the internal acro forms structures are not populated with new values.
Due to this reason the some things may not work properly.
You need to reload the page somehow.
Please try to call page.Dispose(). This is initiates a page reload.
Users browsing this topic
Guest
Forum Jump  
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.