Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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. 😉
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hm, odd, when I press tab (with the script applied) it simply moves to the next box without checking anything. Only if I press the spacebar the box get ticked and green, but that green only stays green as long as the box is still selected. Once I press tab again the green color is gone. But well, anyway, what I've got now is more than I had when I started my quest so... it's fine as it is. 😉
Copy link to clipboard
Copied
Can you share your file?
Copy link to clipboard
Copied
See attachement! As it is now tab selects the next checkbox and space fills it with a black square. Preferably I'd want to check and move on to the next box with just ONE keystroke and I'd like to have the ticked item to say in green permanently. If at all possible... 😉
BTW I am quite happy with how it is right now already but the main thing I'd like to get done is having to use only ONE keystroke to tick an item and move to the next. Changing it to green would be nice but is less important. 😉
Copy link to clipboard
Copied
That file didn't have any script in it, so I added the script I posted above.
It works fine for me, tabbing through checkboxes to check them and turn them green (no need to press anything else except TAB).
BTW, you probably don't see green because you have field highlights turned on, go to Preferences ⇾ Forms and uncheck 'Show border hover colors for fields'.
Here is your file with scripts:
https://drive.google.com/file/d/1sIdJbZ_nAZg0UYFly1wRjlJFUcydHtwg/view?usp=sharing
Copy link to clipboard
Copied
Wow, cool, thanks! And I am sorry: I think I uploaded the wrong version without the script indeed... But great to see it works in your pdf!!! I will keep this one for future reference and see if I can figure out why the script didn't work for me... Perhaps because I added it with a hard return in the middle (as was posted in this topic). But well, this is great anyway! And I will check that border setting: thanks for the tip! 🙂
Copy link to clipboard
Copied
Hm, this is soooo odd... I tried to do what you did, I copied the exact same settings and the exact same script but in MY pdf tabbing does NOT do what it does in your pdf... It simply moves to the next box without checking the previous one. So odd... I don't understand why it DOES work in your pdf but not in mine with the exact same settings (as far as I can see).
Of course I am happy with the file you edited but if I can't create this option myself it's not of real use for me (like whenever I need to change something in the checklist).
Very odd... I must be missing something obvious but I just can't get it done.
Copy link to clipboard
Copied
Share file that doesn't work for you.
Copy link to clipboard
Copied
The boxes stay green after checking them (this version shows the V again) but the tab key only moves between the beoxes and don't tick them as in your pdf.
Copy link to clipboard
Copied
That's because you added script as 'Mouse UP' action, it should be 'On Focus' action.
Copy link to clipboard
Copied
Aaaaaaah, that's it! I had to search for a while because I am using a Dutch version and in Dutch that option is called 'Veld activeren' (which would translate to 'Activate field'). I also didn't notice that adding a script also adds the action that goes along with it: I changed the action at the top of that screen a few times but that is only used to setup a new action you want to add so nothing changed... If you get what I mean.
But anyway, I got it working now! Awesome! Thanks for all the help! 🙂

