• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

circling choice around an object as part of a form fill-in

Guest
Nov 05, 2016 Nov 05, 2016

Copy link to clipboard

Copied

Hi everyone,

I was creating a fill-in form with Acrobat, which would look great if I could circle a choice out of 4 items to pick from.

Excellent, Good, Poor, Fair.

I was able to use Mr. Karl Heinz Kremer code for circling Yes and No, which works perfectly.

Following this post here:

Circle something on a PDF just by clicking on it. (Create PDF)

Any assistance greatly appreciated.

Perhaps that great code can be modified to work with a choice of 4 items as apposed to 2.

I have no coding knowledge. Hence the question.

Thank you for your time and help in advance.

Sincerely,

Jerry

TOPICS
PDF forms

Views

765

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 11, 2016 Nov 11, 2016

Sorry about the late reply. Somehow this question slipped by me.

In the case of four buttons, I would modify the code a bit to make it easier to turn the other buttons off. For this to work, you need to change the name of your four buttons from using a name prefix (e.g. "Button1") followed by a "_someOption" to using a period as the delimiter between the two parts of the name: "Button1.someOption". This allows us to treat all four buttons (or more, this solution is no longer limited by how many b

...

Votes

Translate

Translate
Community Expert ,
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

Sorry about the late reply. Somehow this question slipped by me.

In the case of four buttons, I would modify the code a bit to make it easier to turn the other buttons off. For this to work, you need to change the name of your four buttons from using a name prefix (e.g. "Button1") followed by a "_someOption" to using a period as the delimiter between the two parts of the name: "Button1.someOption". This allows us to treat all four buttons (or more, this solution is no longer limited by how many buttons you want to group) as one - or to get all "children" of the "Button1" group of buttons. So, name your buttons e.g. "Button1.Opt1", "Button1.Opt2", "Button1.Opt3", and so on, and then use the following code as the button action in each button:

var baseName;

var currentState;

// get our name

var theName = event.target.name;

var re = /(.*)\.(.*)/;

var ar = re.exec(theName);

if (ar.length > 0) {

    baseName = ar[1];

    currentState = ar[2];

    // make this button visible

    event.target.buttonSetIcon(this.getField("icon").buttonGetIcon());

    event.target.buttonPosition = position.iconOnly;

   

    // hide the other button

    var f_parent = this.getField(baseName);

    var f = f_parent.getArray();

    for (var i in f) {

        if (f.name != theName) {

            f.buttonPosition = position.textOnly;

       }

    }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

LATEST

Thank you so much Karl, I owe you. You are the man.

Can't wait to try it out, when I get back to my laptop.

Much grateful for your wonderful code and super kind helping hand.

Sincerely,

Jerry

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines