Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Como validar que en un campo numérico el número introducido sea entero y no decimal

Community Beginner ,
May 24, 2023 May 24, 2023

Hola.

Necesito establecer en un formulario de adobe acrobat que en unos campos numéricos no se puedan introducir números decimales, solo enteros, de forma que si se introduce un número decimal aparezca un mensaje indicando que hay un error.

Un saludo

TOPICS
How to , JavaScript , PDF forms
588
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
May 24, 2023 May 24, 2023

Try this as validate script of that field:

var reg = /^-?\d+$/;
var str = event.value;
if(event.value){
 if(!reg.test(str)){
 event.rc = false;
 app.alert("Your message goes here",3);}}

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 24, 2023 May 24, 2023

Try this as validate script of that field:

var reg = /^-?\d+$/;
var str = event.value;
if(event.value){
 if(!reg.test(str)){
 event.rc = false;
 app.alert("Your message goes here",3);}}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 25, 2023 May 25, 2023
LATEST

Perfect!! Thank you very much

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines