Form Field Format adding "x" behind number for Quantity

Community Beginner ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Hello again,

 

the title should explain my question. I tried the "Arbitrary Mask" with usually format i know from excel like 0 "x" and # "x" but it doesnt work so Acrobat seems to have a little bit different format system.

I just want a field where the user can enter a number and after going out of field the number should get displayed with an "x" behind. When editing the field the x should not be inside the form so just visual.

 

Many Thanks

TOPICS
How to, PDF forms

Views

42

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 ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

I don't know the length in numeric characters that you need to type in that field, so in the case that the you need a lengthy number  separated by coma you can use a custom format script in the event target field like this:

 

var f = event.target;

if (!event.willCommit) event.value = "x"+ util.printf("%,0.0f", Number(event.target.value));

 

Using this expression answers your inquiry and also  allows to use the value typed in that field with other dependent calculating fields in that form regardless of the "x" preface string value added to it.   

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
Engaged ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

He should have said condition of number length, but anyway I know this is old philosophy problem what is behind a number and what is in front of number but in this case I belive OP wants x after numbers and not before.

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 ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

LATEST

Thank you Asim.

 

Then  I guess it would be like :

var f = event.target;

if (!event.willCommit) event.value = util.printf("%,0.0f", Number(event.target.value)) + "x";

 

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