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

(HELP!)Trying to remove the (dot) in the textfield after pressing the (dot) key

New Here ,
Mar 10, 2020 Mar 10, 2020

Copy link to clipboard

Copied

I am trying to remove the (dot) in the textfield and move the cursor to the next field.

There are two fields, one field is for price and the next field is for the cents. but when every time I press the (dot) key, it doesn't update the field.

here's my script: (DOCUMENTS JAVASCRIPTS)

function goNext(item,event,cName){
// keystroke filter for numeric data only - change for other character filters;
AFNumber_Keystroke(0,0,0,0, "",true);

if(event.rc && event.change == ".") {
var cStr = event.target.value
var cStr = cStr.replace(".","");
event.value = cStr; <--- this area doesn't work.
item.getField(cName).setFocus();
}

 

Custom Keystroke Script:

goNext(this, event, "CENTS");

TOPICS
Acrobat SDK and JavaScript

Views

285

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 ,
Mar 11, 2020 Mar 11, 2020

Copy link to clipboard

Copied

Why don't you use a single field with a normal "number" format?

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 ,
Mar 11, 2020 Mar 11, 2020

Copy link to clipboard

Copied

LATEST

In your script I guess you should replace:

var cStr = event.target.value

 

By:

var cStr = event.value

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