8 Replies Latest reply on Sep 26, 2015 7:34 PM by brew9

    how to change radio button sizes

    omanbux Level 1

      Hi. in my form lot of radio buttons available & i want that all the radio button sizes change to bellow size. i don't have any issue with radio button location & just want to change the size. can u pls provide JavaScript for this work. thanks..

       

      radio button size should be - width - 0.15 in & height 0.15 in

        • 1. Re: how to change radio button sizes
          try67 MVP & Adobe Community Professional

          To change the size of any field you need to set its rect property, which defines a rectangle area using two points. So you can take the existing first point in the rect array (the upper-left corner) and then calculate what the second point should be (the lower-right corner) based on the size you want the field to have.

          One important thing to remember is that the values of this property are in points, which can converted to inches using this formula:

          1 inch = 72 points

          Another important thing to keep in mind is that the coordinates of the page start from the bottom-left corner.

          • 2. Re: how to change radio button sizes
            omanbux Level 1

            Hi, in my form radio buttons available in different places. can u give some example code using any values so i can get some idea. thanks a lot for your quick reply..

            • 3. Re: how to change radio button sizes
              try67 MVP & Adobe Community Professional
              var inch = 72;
              var size = inch * 0.15;
              var f = this.getField("Radio1");
              var r = f.rect;
              r[2] = r[0]+size;
              r[3] = r[1]-size;
              f.rect = r;
              
              • 4. Re: how to change radio button sizes
                omanbux Level 1

                Hi, thanks. i have replace "radio1' with one of my radio button name & it's change the size correctly. the problem is yes & no both radio buttons came to same place.radio button positions should as per bellow..also i want change all the radio button sizes. thanks..

                 

                Yes radio button - left 7.16 in

                No radio button - left 7.56 in

                • 5. Re: how to change radio button sizes
                  omanbux Level 1

                  I mean should be 0.5 in space in between Yes & no buttons. thanks..

                  • 6. Re: how to change radio button sizes
                    brew9 Level 1

                    var fieldWH = this.getField("field_size").value;

                     

                    for(var i = 0; i < this.numFields; i++)

                    {

                      var name = this.getNthFieldName(i);

                      var field = this.getField(name);

                      var ft = field.type;

                      var fn = field.name;

                     

                      if (ft == "checkbox")

                      {

                        var aRect = field.rect;

                        aRect[2] = aRect[0] + fieldWH;

                        aRect[3] = aRect[1] - fieldWH;

                        field.rect = aRect;

                      }

                     

                      if (ft == "radiobutton")

                      {

                        var nWidgets = 0;

                        while(true) {

                          var temp = this.getField(fn + "." + nWidgets);

                          if ( temp != null )

                          {

                            var aRect = temp.rect;

                            aRect[2] = aRect[0] + fieldWH;

                            aRect[3] = aRect[1] - fieldWH;

                            temp.rect = aRect;

                          }else{

                            break;

                          }

                          nWidgets++;

                        }  

                      }

                    }

                    • 7. Re: how to change radio button sizes
                      omanbux Level 1

                      hi, thanks a lot for your code. it's giving bellow error. thanks.

                       

                      [ Line: 00000 { (null) } ] : Null null.value cannot convert to Object

                      • 8. Re: how to change radio button sizes
                        brew9 Level 1

                        this line: var fieldWH = this.getField("field_size").value;

                        I create a text field is able to give the value that you went. You can delete it, and do this:

                        //var fieldWH = this.getField("field_size").value;

                        var fieldWH = 10.8