Javascript to prevent form submit/warn if two fields are identical
On a mac using Acrobat Pro. I'm working on a pdf form with a fair amount of embedded javascript and I'm stuck on something that seems like it should be straightforward, but my script knowledge is just too basic.
There are two fields which need to be unique. If the same number goes in both fields I'd like a warning to flash up and to prevent the pdf from being submitted. I tried adding a validation script to the individual fields. Field A:
if (this.getField("FieldB").value==event.value({
app alert("Warning");
}
I've tried variants on this defining the variable of fields A and B and doing if/else but I'm just not managing to get it to work.
The two fields which need to be unique have a custom format as they are number fields which allow leading zeros, not sure if this is complicating matters? They're both required fields.
Anyone able to point me in the right direction?
