Skip to main content
Participating Frequently
September 17, 2022
Answered

Interactiv PDF (Formular field) problem

  • September 17, 2022
  • 3 replies
  • 1458 views

I have a problem with an interactive PDF.
Only the corresponding number (no other) may appear in the fields (3x3). Fields 1-8 work. But not the 9. Anyone know why?

See here download: Interaktives PDF 

This topic has been closed for replies.
Correct answer bebarth

Hi,

With this script, you can type several 9 in the box!

You can only allow one 9 number in the box with this custom keystroke script:

if(!event.willCommit) {
	event.rc=/^9$/.test(event.value+event.change)==true || event.change=="";
}

or this one if you wish a message:

if(!event.willCommit) {
	if (!(/^9$/.test(event.value+event.change)==true || event.change=="")) {
		event.rc=false;
		app.alert("You only must type a 9 in this box.",3);
	}
}

@+

3 replies

bebarth
Community Expert
bebarthCommunity ExpertCorrect answer
Community Expert
September 17, 2022

Hi,

With this script, you can type several 9 in the box!

You can only allow one 9 number in the box with this custom keystroke script:

if(!event.willCommit) {
	event.rc=/^9$/.test(event.value+event.change)==true || event.change=="";
}

or this one if you wish a message:

if(!event.willCommit) {
	if (!(/^9$/.test(event.value+event.change)==true || event.change=="")) {
		event.rc=false;
		app.alert("You only must type a 9 in this box.",3);
	}
}

@+

Participating Frequently
September 17, 2022

great! It works! Thanks so much

Nesa Nurani
Community Expert
Community Expert
September 17, 2022

Use this as 'Custom keystroke script' in field for number 9:

var x = /^9*$/.test(event.change);
if(!x)
app.alert('The value entered does not match the format of the field = "9"');
event.rc = /^9*$/.test(event.change);

Participating Frequently
September 17, 2022

many thanks
okey, but i dont know, where i put this java...can you explain? Or do it in the PDF ;)?

Nesa Nurani
Community Expert
Community Expert
September 17, 2022

In the 'Format' tab, select 'Custom' and where it says 'Custom keystroke script' click on 'Edit' and paste script inside.

Bernd Alheit
Community Expert
Community Expert
September 17, 2022

A 9 in the arbitrary mask allows every number.

Participating Frequently
September 17, 2022

yes, but why except 9?

Bernd Alheit
Community Expert
Community Expert
September 17, 2022

There has the 9 a special meaning.