Skip to main content
Participant
July 9, 2020
Question

Help with PDF JavaScript

  • July 9, 2020
  • 1 reply
  • 427 views

Hi community, 

      I would like some help with some javascript ! The script I found helps me with marking circles over answers on a pdf that I have. However, I would like some help changing the code so that if I click on the button again, the circle disappears--to give people the option of selecting and deselecting. Any help much appreciated. 

The code is below. Credit Source: http://khkonsulting.com/2016/11/mark-selected-options-with-circles-in-pdf-forms/#:~:text=On%20the%20%E2%80%9COptions%E2%80%9D%20tab%20select,select%20options%20on%20the%20form.

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[i].name != theName) {

               f[i].buttonPosition = position.textOnly;

           }

         }

       }

       this.calculateNow();

This topic has been closed for replies.

1 reply

ls_rbls
Community Expert
Community Expert
July 15, 2020

I would say that, in lieu of no one responding to your inquiry yet, that the adequate netiquette (or to show some respect to  to the original author of this script)  is to contact Karl Heinz Kremer  at  KHKonsulting LLC: khkonsulting@khk.net