Skip to main content
Known Participant
October 13, 2021
Question

Grouping Text Fields & Check Boxes under Specific Category in PDF Form

  • October 13, 2021
  • 1 reply
  • 2916 views

In my form, an individual will select a checkbox with the category, once selected it will open up the category section with additional information needed in text fields and checkboxes.  I have found how to hide and display the fields dependent on the category box being checked or not.  I am just having a really hard time with getting the category information fields/boxes to move up or down the document depending on the other category boxes checked - and keeping the same properties.  I tried the rect javascripting, but something is not working right.  

 

I was thinking I could group all the fields together under the Category Section name, then overwrite the hidden category sections/information fields when they are not visible.  Is this possible?

 

If needed, here is what I was currently using for my javascript on the MouseUP action:

var a = this.getField("Category2 checkbox"); 

var b = this.getField("Category1 Label").rect; 

var c = this.getField("Category1 Text Field1").rect; 

if (a.is Box Checked(0)) {

     this.getField("Category2 Label").display = display.visible

     this.getField("Category2 Text Field1").display = display.visible

}

else {

     this.getField("Category2 Label").display = display.hidden

     this.getField("Category2 Text Field1").display = display.hidden

}

var d = this.getField("Category1 checkbox"); 

if (((d.is BoxChecked(0)) && (a.isBoxChecked(0))) || (d.isBoxChecked(0))) {

     this.getField("Category2 Label").rect = [72,215,303,237];

     this.getField("Category2 Text Field1").rect = [71,191,201,213];

}

else if (a.isBoxChecked(0)) {

     this.getField("Category2 Label").rect = [b[0], b[3]+22, b[0]+231, b[3]];

     this.getField("Category2 Text Field1").rect = [c[0], c[3]+22, c[0]+130, c[3]];

}

else if (event.target.value == "Off") {

     this.getField("Category2 Label").rect = [72,215,303,237]; 

     this.getField("Category2 Text Field1").rect = [71,191,201,213];

}

 

 

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
October 13, 2021

Instead of making it complicated for yourself,have you consider using layers to show/hide groups of fields?

Bobbi5CA8Author
Known Participant
October 13, 2021

No, I have not.  I will do anything to make this less complicated!  How do  I use layers?  Is it a javascript?

Nesa Nurani
Community Expert
Community Expert
October 13, 2021

Try watching this video, you will see how it works and if it's right for you.

https://www.youtube.com/watch?v=akF7wa0ggvQ