Esempio n. 1
0
        public PdfFormField GetRadioGroup(string name, string defaultValue, bool noToggleToOff)
        {
            PdfFormField radio = PdfFormField.CreateRadioButton(writer, noToggleToOff);

            radio.FieldName   = name;
            radio.ValueAsName = defaultValue;
            return(radio);
        }
Esempio n. 2
0
        /**
         * Gets a radio group. It's composed of the field specific keys, without the widget
         * ones. This field is to be used as a field aggregator with {@link PdfFormField#addKid(PdfFormField) AddKid()}.
         * @param noToggleToOff if <CODE>true</CODE>, exactly one radio button must be selected at all
         * times; clicking the currently selected button has no effect.
         * If <CODE>false</CODE>, clicking
         * the selected button deselects it, leaving no button selected.
         * @param radiosInUnison if <CODE>true</CODE>, a group of radio buttons within a radio button field that
         * use the same value for the on state will turn on and off in unison; that is if
         * one is checked, they are all checked. If <CODE>false</CODE>, the buttons are mutually exclusive
         * (the same behavior as HTML radio buttons)
         * @return the radio group
         */
        public PdfFormField GetRadioGroup(bool noToggleToOff, bool radiosInUnison)
        {
            PdfFormField field = PdfFormField.CreateRadioButton(writer, noToggleToOff);

            if (radiosInUnison)
            {
                field.SetFieldFlags(PdfFormField.FF_RADIOSINUNISON);
            }
            field.FieldName = fieldName;
            if ((options & READ_ONLY) != 0)
            {
                field.SetFieldFlags(PdfFormField.FF_READ_ONLY);
            }
            if ((options & REQUIRED) != 0)
            {
                field.SetFieldFlags(PdfFormField.FF_REQUIRED);
            }
            field.ValueAsName = vchecked ? onValue : "Off";
            return(field);
        }