Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

Find RadioButton selected index or value

Last post 05-10-2010, 3:02 PM by aspose.notifier. 8 replies.
Sort Posts: Previous Next
  •  02-02-2010, 1:45 PM 220330

    Find RadioButton selected index or value .NET

    Attachment: Present (inaccessible)
    Hello,

    I am using Aspose.Pdf to create a pdf containing radio buttons, and then using Aspose.Pdf.Kit to manipulate the form.

    After loading the pdf into a Aspose.Pdf.Kit.Form, I am unable to get the selected index or value of the radio button.  

    I have tried Form.GetField("ButtonName"); and it returns a blank string.

    Form.GetButtonOptionCurrentValue("ButtonName"); Throws a PdfKitException "Unable to find selected value for the specified field!".

    I am also unable to use Form.FillField("ButtonName", int); to change the selected index.

    How can I get the index or value of the selected radio button?

    Sample code to create the PDF:

    Pdf ThisPdf = new Pdf();

            MarginInfo marginInfo = new MarginInfo();
            marginInfo.Top = 28;
            marginInfo.Bottom = 28;
            marginInfo.Left = 28;
            marginInfo.Right = 28;

            Section MainSection = ThisPdf.Sections.Add();
            MainSection.PageInfo.Margin = marginInfo;

            //add table for layout of radio buttons
            Aspose.Pdf.Table RadioTable = new Aspose.Pdf.Table();
            MainSection.Paragraphs.Add(RadioTable);

            // add rows and cells to hold the radio button text
            Row ThisRow;
            Cell ThisCell;

            ThisRow = RadioTable.Rows.Add();
            ThisCell = ThisRow.Cells.Add("Red");
            ThisCell.Padding.Left = 30;
            ThisCell.Paragraphs[0].ID = "RedOption";

            ThisRow = RadioTable.Rows.Add();
            ThisCell = ThisRow.Cells.Add("Yellow");
            ThisCell.Padding.Left = 30;
            ThisCell.Paragraphs[0].ID = "YellowOption";

            ThisRow = RadioTable.Rows.Add();
            ThisCell = ThisRow.Cells.Add("Green");
            ThisCell.Padding.Left = 30;
            ThisCell.Paragraphs[0].ID = "GreenOption";

            // Make the Radio control to hold the radio items
            FormField ThisRadioControl = new FormField();
            ThisRadioControl.FormFieldType = FormFieldType.RadioButton;
            ThisRadioControl.FieldName = "Color";
            ThisRadioControl.RadioButtonCheckedIndex = 0;

            // Add Radio Buttons
            Aspose.Pdf.RadioButton bt1;

            bt1 = ThisRadioControl.RadioButtons.Add();
            bt1.ButtonHeight = 12;
            bt1.ButtonWidth = 12;
            bt1.PositioningType = PositioningType.ParagraphRelative;
            bt1.ReferenceParagraphID = "RedOption";
            bt1.IsInList = true;
            bt1.Left = -20;
            bt1.Top = 0;

            bt1 = ThisRadioControl.RadioButtons.Add();
            bt1.ButtonHeight = 12;
            bt1.ButtonWidth = 12;
            bt1.PositioningType = PositioningType.ParagraphRelative;
            bt1.ReferenceParagraphID = "YellowOption";
            bt1.IsInList = true;
            bt1.Left = -20;
            bt1.Top = 0;

            bt1 = ThisRadioControl.RadioButtons.Add();
            bt1.ButtonHeight = 12;
            bt1.ButtonWidth = 12;
            bt1.PositioningType = PositioningType.ParagraphRelative;
            bt1.ReferenceParagraphID = "GreenOption";
            bt1.IsInList = true;
            bt1.Left = -20;
            bt1.Top = 0;

            MainSection.Paragraphs.Add(ThisRadioControl);

    I have also attached the sample pdf.

    Thanks for any help
     
  •  02-03-2010, 3:59 AM 220437 in reply to 220330

    Re: Find RadioButton selected index or value

    Hi Ken,

    I have reproduced this problem at my end and logged it as PDFKITNET-14113 in our issue tracking system. Our team will look into this issue and you'll be updated via this forum thread once the issue is resolved.

    We're sorry for the inconvenience.
    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  02-08-2010, 9:18 AM 221228 in reply to 220437

    Re: Find RadioButton selected index or value

    Hi Ken,

    Our team has looked into this issue and I would like to inform you that the file you shared earlier contains only radio button with the appearance attributes, but doesn't contain option values. Since the options are not defined for this button, we would only be able to return the values 'On' or 'Off' for the button instances, but we won't know which button's value is 'On' or 'Off'. Is it something you want? If not, please specify the button option values explicitly for all the three radio button instances.

    Please share your further thoughts, so we could proceed with this issue.
    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  02-08-2010, 11:48 AM 221265 in reply to 221228

    Re: Find RadioButton selected index or value

    Thanks for the response.

    I would like to be able to specify the button option values when the pdf is created, and then retrieve the selected value.  I have tried to set the radio button values, but I have been unsuccessful.  Could you provide me with an example of how I could modify the code I used to create the form to explicitly set the button option values? 

     
  •  02-09-2010, 6:50 AM 221424 in reply to 221265

    Re: Find RadioButton selected index or value

    Hi Ken,

    We're looking into this matter and you'll be updated with the status shortly.

    We're sorry for the inconvenience.
    Regards,


    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  02-11-2010, 12:22 AM 221799 in reply to 221265

    Re: Find RadioButton selected index or value

    Hello Ken,

    Sorry for replying you late.

    I've tested the scenario and I'm able to notice that there is no such mechanism to specify the RadioButton values. For the sake of correction, I've logged this requirement under New Features list as PDFNET-14292 over our Issue tracking system. We will look into the details of this matter and will keep you updated with the status of correction.

    Please be patient and spare us little time. Your cooperation and comprehension is greatly appreciated in this regard.

    We apologize for your inconvenience.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  02-11-2010, 12:35 PM 222014 in reply to 221799

    Re: Find RadioButton selected index or value

    Is there currently a way to get the selected index of the field and change it?  
     
  •  02-12-2010, 4:57 AM 222124 in reply to 222014

    Re: Find RadioButton selected index or value

    Hi Ken,

    Yes, this is possible. You can get all the option button values using GetButtonOptionValues method. If you want to get currently selected value you can use GetButtonOptionCurrentValue. In order to change the current index you can use FillField method.


    I hope this helps. If you have any further questions, please do let us know.
    Regards,

    Shahzad Latif - [Follow me on Twitter!]
    Support Developer/Developer Evangelist
    Aspose Sialkot Team
    Aspose - Your File Format Experts

    Keep in touch! We're on Twitter and Facebook
     
  •  05-10-2010, 3:02 PM 237145 in reply to 220330

    Re: Find RadioButton selected index or value

    The issues you have found earlier (filed as 14292) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
View as RSS news feed in XML