Mr Ariel Walden wrote: (he only scripts for Indesign)
Try adding two }} at the end of the script. They seem to be missing.
Perhaps, that is the reason many people don't script —like myself, I suppose — as this kind of very difficult mysteries never get solved.
In the same line, that could have helped, another script never got solved for the same reason:
Dead donkey, dead load.
But you do script, and you're learning, which is what you need to do. As you learn the language more, you'll have fewer problems like this, or at least you'll be able to identify and fix them easier. A lot of people try to script without learning the language, which only makes things more difficult.
What about this?
Although is not working, in theory it seems a solution?
How to re-write line 3?
As a Documenl level script:
1. function checkField(aField)
3. if (aField.value == "") // empty field
5. var msg = "No fields can be left empty.";
7. return 0;
9. } // end of function
As a Mouse Script generic for a trigger button (next/previous page/ print form...):
PD I am observing that some threads here are from designers who want to improve forms, but no so far as learning a lot of Java. The Indesign scripting forum is different as only very special situations are posted: the software is very strong and very well documented. In Acrobat all has to be scripted and a practical use of functions are a nightmare for designers. For example: validating fields is a must for today. But all the threads I read these days are unconcluded, not really clear. Validating field for something outside the Java circle is impossible. Perhaps something that alters the scenery is that scripted solutions are usually sold. It is a business behind it, something that does not happen frequently in Indesign.