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

New Here ,
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, PDF forms

Views

33

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

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

New Here ,
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, PDF forms

Views

34

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
Mar 10, 2020 0
Adobe Community Professional ,
Mar 11, 2020

Copy link to clipboard

Copied

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

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
Reply
Loading...
Mar 11, 2020 0
Adobe Community Professional ,
Mar 11, 2020

Copy link to clipboard

Copied

In your script I guess you should replace:

var cStr = event.target.value

 

By:

var cStr = event.value

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
Reply
Loading...
Mar 11, 2020 0