How to make a pop-up (app.response) where u can only fill in numbers?

Community Beginner ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Below is a part of my code. I currently have the text added to the pop-up windows that asks the users only to fill in numbers, but I am sure a couple users will not read it well enough. So my question is, how can I make sure the users can only fill in numbers and not letters or other symbols in the response box? Thanks in advance.

 

if (global.fileCounter==null) {
var cRTN = app.response( {cQuestion:"Fill in the correct document number. ONLY USE NUMBERS",cTitle:"DOC-number",cLabel:"DOC-"});

 

 

 

 

TOPICS
How to , JavaScript

Views

59

Likes

Translate

Translate

Report

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 ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Hi Niels.

You can go into the field properties (select Prepare Form from the Tools menu) and change the filed's Format to "Number".  Similar to Excel you can, set the number of decimal places, seperator style, currency symbols, etc. and set the paramaters to your liking.

AdobeFormat_Capture.PNG

 

 I use this feature pretty often when creating forms for my department. Hope that helps! 😊


Always with gratitude.
Máia

Likes

Translate

Translate

Report

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 ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Hi, thanks but this is not what I meant. 

My script puts Bates numbers on multiple PDF-files at once, so a form will not work unfortunately. It has to be included in my code somehow. 

 

 

 

 

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

LATEST

You can't force them to only enter numbers. You can, however, validate what they entered and if it's invalid display an error message and stop the script from executing further.

Something like this:

 

if (cRTN==null || /^\d+$/.test(cRTN)==false) {
	app.alert("Invalid value.");
} else {
	// rest of code goes here
}

Likes

Translate

Translate

Report

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