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

How to use only Digits ,Backspace ,Delete button only in PDF using JavaScript

Community Beginner ,
May 25, 2022 May 25, 2022

Copy link to clipboard

Copied

Ho to modify the following code just to add backspace and delete button to the allowed list.

 

var digits = /^\d$/;

if(event.willCommit == false){

  if(event.change && digits.test(event.change) == false){

          app.beep();

          event.rc = false;

         }

}

 

 

TOPICS
Create PDFs , Edit and convert PDFs , How to , JavaScript , PDF forms

Views

190

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 Expert ,
May 26, 2022 May 26, 2022

Copy link to clipboard

Copied

What is the issue with this script?

Votes

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 Expert ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

LATEST

You may need to elaborate your question, it's a little difficult to understand the exact workflow that you're trying to achieve.

 

For example, are you asking to fornat a text field to display only numerical characters (no letters or special characters)?

 

And Are you also asking if you can add a button object to the PDF so that when a user clicks  on it it will delete the numeric strings entered in that field  in the same way like a backspace key would do when it is pressed repeatedly on an actual keyboard peripheral device?

Votes

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