Can not use the arbitrary mask since all the error messages have to come in German. Here's my code:
On the email button:
mouse-up :
if (this.getField('R.1').value== "" || this.getField('R.1').value == null) {
event.rc=false;
app.alert('Bitte erfassen Sie eine 9-stellige, gültige Partnernummer.');}
else {
this.mailDoc();
}
On print button, mouse down:
if (this.getField('R.1').value== "" || this.getField('R.1').value == null)
{
this.print = false;
app.alert('Bitte erfassen Sie eine 9-stellige, gültige Partnernummer.');}
else {
this.print(true, this.pageNum);
}
My text field has a validation in the validation tab:
if(event.value == null || event.value == "") {
event.rc=true;
}
else
if(event.value.match(/^(?:(?:[+\-]?(?:(?:0(?:(\.)[0-9]+)?)|(?:[1-9][0-9]*(?:(\.)[0-9]+)?)|(?:(\.)[0-9]+))(?:[eE][\+\-][1-9][0-9]*)?))$/) == null) {
event.rc=false;
}
else if(event.value.length < 9){
event.rc=false;
}
else {
event.rc=true;
}
I'm a front-end web developer and for some reason my boss thinks if it's JavaScript, I can do it.
Well. this isn't the case here.
If you can help me out I would really appreciate it.
Thanks.
The validation script needs to be in the field in question. event.rc doesn't exist for a Button. Also, the value of a text field is never null. An empty field is an empty string. There are examples of how to write validation scripts ALL OVER these forums and in the JavaScript for Acrobat documentation.
And... for what it's worth... if it's JavaScript, you can, in fact, do it. That's all this is, it's just that the object model and how scripts get stored and triggered is different. The core JS is the same.