Skip to main content
Inspiring
June 9, 2023
Answered

Interactive checklist which automatically pre-selects next option

  • June 9, 2023
  • 1 reply
  • 4791 views

I posted the following in the InDesign forum (Interactive checklist which automatically pre-selects next option) and was adviced to try it here. 😉 So here is a copy of my previous post:

 

I have a checklist with some 40 items. Each line has a box in front and when I create a pdf I can click on a box to 'tick' it. Nice. But not what I want.

 

I'd like to create a checklist which starts with the first line selected. I want to be able to tick the item with the spacebar after which the next item should automatically be selected in order to tick it and so on down the list.

 

So:

1. first item is selected

2. I press the spacebar which ticks the first item

3. after which the next item is automatically selected 

4. I then can tick that selected item with the spacebar

5. after which the next item is selected

6. and so on

 

Is this possible with InDesign...? (EDIT Or using Acrobat?)

 

It would also be great already if after ticking an item I could select the next item using the arrow keys. As it is now I can ONLY tick an item with the mouse or spacebar and then I have to use the mouse to select (and immediately tick) the next one (or any one). I'd like to be able to finish the entire checklist without using the mouse.

 

In addition to this: the tickbox shows a tick (like a V) when it is ticked (in Acrobat). Is it possible to change this and for instance make the box completely green when it is ticked?

This topic has been closed for replies.
Correct answer Nesa Nurani

You can do it while tabbing through checkboxes, by using 'On focus' script in each checkbox to check it and turn checkbox fill color to green with this script:

event.target.checkThisBox(0,true);
event.target.fillColor = color.green;

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
June 9, 2023

You can do it while tabbing through checkboxes, by using 'On focus' script in each checkbox to check it and turn checkbox fill color to green with this script:

event.target.checkThisBox(0,true);
event.target.fillColor = color.green;

J van EAuthor
Inspiring
June 9, 2023

Wow, that's cool! I did a Google search on how to add scripts 😉 and I got! BTW I also found out (thanks to your post) than tab already automatically moves you to the next box... 

But... if I may ask two more things:

- your post seems to imply (but I coould be totally wrong 😉 ) that by pressing tab the box should be ticked and turn green. However, after tabbing the next box is selected (which already happens by default) but I still have to press the spacebar to make the box green and then tab again (tab - space - tab - space etc.). Not a problem at all, I am very happy with this script already but if just using one key to make a box green AND select the next one that would be great. 😉

- the box only turns green while being active... Once I tab to the next box the previous isn't green anymore and simply shows the default V (tick). But well, no reall problem because I also found out in the meantime how to change the V-tick to a black square which is also nice already. 😉 

Nesa Nurani
Community Expert
Community Expert
June 9, 2023

You can run this script from console or a button to populate all checkbox fields in file with a script:

for(var i=0; i<this.numFields; i++){
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if(f==null) continue;
if(f.type=="checkbox") f.setAction("OnFocus", "event.target.checkThisBox(0,true);event.target.fillColor = color.green;");}

Yes, by pressing tab it should immediately check and turn checkbox green.