I too an interested in this - I have a code that interacts with two fields - and you can only put data in one of the fields. So upon entering field B adobe checks to see if field A is null - if it is not an alert pops up and says "You can only have data in one field, shall I erase the data in the other field". Now, I can just put an empty string (value = "") but then that is not the same thing as null and so my code breaks down and even when the cell is empty (contains a zero length string "") the error message still runs. So I need to make it null and not just "" - how can I do this?
(by the way if it matters, it is a number field). Here is the code:
var FedDol = this.getField("IncomeTaxWitheldFederalPercent");
//Check to see if the other field is null
if (FedDol.value != null)
//If it is null run the alert
var nRslt = app.alert("Only one federal value may be entered - either dollars or percentage.\n\n" + "Shall I erase the percentage value in order for you to add a dollar amount?",2,2,"Warning");
//If the users selects 'yes' make the other field null
if(nRslt == 4)
FedDol.rawvalue == null;
— AndrewAlb
Either forms technology will allow you to set null values, but you have to use the correct syntax for that technology.
A better way to do your test is use regular expressions. That way you catch the situations where the user enters spaces.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script