Skip to main content
Inspiring
June 19, 2024
Question

Wanting to assign strings of text to certain checkboxes

  • June 19, 2024
  • 1 reply
  • 486 views

Hello! I am building an audit checklist with a series of checkboxes alongside list items, with two dropdowns for each item (time frame and assignee). I would like the user to be able to check off anything they've already accomplished and for the remaining items, choose a 30 day, 60 day or 90 day timeframe as well as an assignee.

 

I will be creating summary boxes for each grouping of information, showing the item name and the assignee. I will be numbering the fields using sequential numbering and use code similiar to below (from a similar project I did a few years ago). Where I'm stuck is how to indicate what the item name is, since it will be static text, and not a field I can pull data from (which is how I accomplished this in the previous project). Can I set some variable to have a corresponding sequential numbering scheme and write out the list items in there? Where should I put that variable?

 

Secondly, as people check off remaining items, I want the piece from the summary box to disappear. I assume adding an if statement that checks for on/off of the checkbox, but I'm not quite certain how to structure that. (I have other times I've checked for on/off or yes/no from a series of checkboxes, but never inside of a loop like this.)

 

Here is the code I used for the previous project so you can see what I'm doing in building the summary fields!

 

var maxFields = 21;
var s = "";
for (var i=1; i<=maxFields; i++) {
	var AcceptedStatus = this.getField("Status"+i).valueAsString;
	if (AcceptedStatus=="Submitted" || AcceptedStatus=="Denied" || AcceptedStatus=="Revisit at a Later Date" || AcceptedStatus==" ") continue;

     var funding=this.getField("FinalAmount"+i).value;
     var fundingformat=util.printf("$%,0 0.0f", funding);

	if (s!="") s+="; ";
	s+=this.getField("FundingOpp"+i).valueAsString + ", " + fundingformat;
}
event.value = s;

 Many thanks if you can get me straightened out, this forum is so greatly helpful! 

This topic has been closed for replies.

1 reply

PDF Automation Station
Community Expert
Community Expert
June 20, 2024

You could put the list item names as the checkbox export values, then loop through the checkboxes and test whether the value does not equal "Off" (the value of an unchecked checkbox), and push the value into your list.

Inspiring
June 20, 2024

Ooooh, that is smart, I am not sure I realized you could assign an export value in that way (at least outside of numbers, not sure why I never considered it for a value as string export).

 

I tested it out and checking off the checkbox will push the value, which is great and the rest of my summary box is set up. However, the behavior I would like to accomplish is letting the user check things off that are already finished and don't need further attention, and then assign things for the unchecked items and organize those into the different time frame summary boxes.

 

Since the export value only seems to fire when the box is checked, what are my options here?

PDF Automation Station
Community Expert
Community Expert
July 30, 2024

If the check box value is equal to "Off", push an empty string.  Otherwise, push the value of the check box.