2 Replies Latest reply on Jun 17, 2013 9:52 AM by LadyAnn08

    Radio button creating text or dropdown field

    LadyAnn08 Level 1

      Hi! I'm having some trouble in a PDF form I am working on for my office. Ideally, I would like when a user selects a radio button for it to populate another field that they can type in (text field.) I'm having some difficulty. The form itself was created in another application and I'm just adding the form fields in Adobe. So, there is a place for a radio button but I would like the selection of that to bring another text field where they can enter something.  Here is the form that I'm trying to get this to work on.

       

      When they select "Pledge Payment," I would like to some how creatate a field right under it where they could enter a pledge number.

       

      What's my best option for doing this? Hope this helps! Thank you!!

       

       

       

      Doc6.jpg

        • 1. Re: Radio button creating text or dropdown field
          George_Johnson MVP & Adobe Community Professional

          The normal way to do this would be to create the text field and control its visibility with a script. The script can either be attached to the radio button (e.g., Mouse Up event) or the text field (e.g., Calculate event). I would suggest using a check box instead of a radio button since radio buttons cannot be deselected once they have been selected. Here is a script you can use as the custom calculation script of the text field:

           

          (function () {

           

              // Get the value of the check box

           

              var v = getField("check1").value;

           

              // Set this field's visibility, which depends on the state of the check box

              if (v === "Off") {

           

                  event.target.display = display.hidden;

           

                  // Clear this field

                  event.value = "";

           

              } else {

           

                  event.target.display = display.visible;

           

              }

           

          })();

           

          Where "check1" is the name of the check box. The same code will work if you use a radio button.

          • 2. Re: Radio button creating text or dropdown field
            LadyAnn08 Level 1

            George,

             

            THANK YOU!! That was so helpful and it did exactly what I wanted! I used the Radio buttons as you suggested. I have one more question Please bare with me. If I wanted to label the field to say something when it became visible, how would I go about doing that?

             

            For example, we are using the Radio button to select a Pledge payment and then show a text field for the user to enter something. If I wanted it to also read something when it became visble, what would I need to do?
            I want for it to say "Pledge number:________" and allow the user to enter in the number. Now, just a blank text field shows up but it doesn't really indicate what the user should do with it. Any suggestions or feedback would be appreciated!

             

            Thanks so much for all your help!!