I just managed to set the field to read only, i was setting the flag in the
wrong component.

bt2.setChecked(true);

the multiple fields still with problem


On Wed, Oct 2, 2013 at 3:43 PM, André Fróes <arfmor...@gmail.com> wrote:

> Hello everyone, I am facing a problem here where only one radio is being
> generated, and same happens for the textbox. I am attaching an exemplo of
> how it is now.
>
> here is my code:
> -------------
>
>                         cell = new
> PdfPCell(defaultFontSelector.process(i.getPrompt()));
>                         cell.setBorder(0);
>                         table.addCell(cell);
>
>                         if (i.getChildren() != null &&
> !i.getChildren().isEmpty()) {
>                             for (CheckListItem it : i.getChildren()) {
>                                 switch (it.getType()) {
>                                     case CHECK_BOX_ITEM:
>                                         RadioCheckField bt2 = new
> RadioCheckField(writer, new Rectangle(300, 300, 400, 400), "rd" +
> i.getId(), it.getPrompt());
>
> bt2.setCheckType(RadioCheckField.TYPE_CHECK);
>
> bt2.setBorderWidth(BaseField.BORDER_WIDTH_THIN);
>                                         bt2.setBorderColor(Color.black);
>
> bt2.setBackgroundColor(Color.white);
>
>                                         PdfFormField radio3 =
> PdfFormField.createRadioButton(writer, true);
>
> radio3.setFieldName(it.getParent().getPrompt());
>                                         parent.addKid(radio3);
>
>                                         PdfFormField rd2 =
> bt2.getRadioField();
>                                         bt2.setOnValue(it.getPrompt());
>                                         bt2.setChecked(false);
>                                         bt2.setBox(new Rectangle(100, 100,
> 200, 200));
>
>                                         float[] widths3 = {2, 10};
>                                         PdfPTable subtable3 = new
> PdfPTable(widths3);
>                                         cell = new PdfPCell();
>
>                                         cell.setCellEvent(new
> PdfProcessor(radio3, rd2, 0));
>                                         cell.setBorder(0);
>                                         subtable3.addCell(cell);
>                                         cell = new
> PdfPCell(defaultFontSelector.process(it.getPrompt()));
>                                         cell.setBorder(0);
>                                         subtable3.addCell(cell);
>
>                                         cell = new PdfPCell(new
> PdfPCell(subtable3));
>                                         cell.setBorder(0);
>                                         table.addCell(cell);
>
>                                         break;
> -----------------
>
> this is the one for checkbox. As I said, it works, but only for the 1st
> record. And another problem that I am facing is that the user will be able
> to select if fields can be editable or not, and I am only managing to make
> it editable. I tried setting for all PdfFormFields the property
> FF_READ_ONLY, but even so, it still comming editable.
>
> Any help will be very appreciated :D
>
> Thanks
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
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