Here are the bits of code in question :

[code]
PdfFormField group1 = PdfFormField.CreateRadioButton(writer, false);
            group1.FieldName = "group1";
            group1.AddKid(CreateCheckBox(over, "check1", 8.5f, 363, 459.8f +
GIFLOffset_1, 0.3f));
            group1.AddKid(CreateCheckBox(over, "check2", 8.5f, 471, 459.8f +
GIFLOffset_1, 0.3f));
            writer.AddAnnotation(group1);[/code]

and the CreateCheckBox method :
[code]
private static PdfFormField CreateCheckBox(PdfContentByte layer, String
name, float size, float llx, float lly, float thickness)
        {
            PdfFormField field;
            RadioCheckField checkbox;
            Rectangle rect = new Rectangle(llx, lly, llx + size, lly +
size);
            checkbox = new RadioCheckField(layer.PdfWriter, rect, name,
"on_" + name);
            checkbox.CheckType = RadioCheckField.TYPE_CHECK;
            checkbox.BackgroundColor = BaseColor.WHITE;
            checkbox.BorderColor = BaseColor.BLACK;
            checkbox.BorderStyle = PdfBorderDictionary.STYLE_SOLID;
            checkbox.BorderWidth = 0.4f;
            checkbox.FieldName = name;
            field = checkbox.RadioField;
            layer.Rectangle(rect);
            layer.SetLineWidth(0.4f);
            layer.Stroke();
            return field;
        }[/code]

This code is part of a larger program that generates a customized document.
The checkboxes are created fine and show up properly, and I can check one or
the other (but not both) as expected, however they cannot be unchecked at
all.

I was under the impression that the false value passed into the
CreateRadioButton method should make it so that you can uncheck a box so
that neither will be checked, but even changing that to true had no effect
on behaviour (that behaviour being that once one of the checkboxes is
checked, one will always be checked unless a reset button elsewhere on the
form is clicked).

Any help getting the checkboxes to be uncheckable would be greatly
appreciated.
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to