PDF Acrobat Operations That Can Only Be Done With JavaScript
When something can't be done with the Acrobat User Interface, a script can be used.
In my last column, PDF Form Reset Tricks, I mentioned how almost every field property of every field type can be set using a script, instead of using the Acrobat Pro user interface (UI). All you need to do is run the script in the JavaScript console (I feel like I just gave myself an idea for a future post. Let me know in the comments what subjects you would like me to cover in future articles.). There are other things that can't be done with the UI and can only be done with a script.
Get the course above, and a suite of automation tools for FREE with a Professional subscription.
An Empty Dropdown Field Item
When I create dropdown fields in PDF forms, I usually set the default item to be nothing, or empty. I don't like redundant instructions like "Please make a selection" as the default. It's a dropdown field. That's what you do – you make a selection.
It's not possible to insert a nothing item into a dropdown list using the Acrobat UI. There's supposedly a "workaround", which is to use a single space in place of nothing. However, if you have any scrips that test the field for whether it has a value, it won't work because a single space is a value, while nothing is not. For example, assume the field's name is "Dropdown1". If the default is a single space and the current value is the default the following script, meaning "Dropdown1" has no value, will return false: