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

number percentage field format needs comma not period

Explorer ,
Mar 28, 2018 Mar 28, 2018

I have a format custom script.

if (event.value !=="" && !isNaN(event.value)){

event.value = util.printf("%.2f",event.value*100);

}else{

event.value = "";

}

and a custom validation script........

if (event.value !== "") {

event.value = event.value / 100 ;

}

if (event.value>1||event.value<0)

{

event.value="";

app.alert("L’entrée doit être entre 0 et 100")

}

I need my Percentage field to read 1,50 % (French)

Currently it reads 1.50 %  (English)

Any help would be appreciated.

TOPICS
Acrobat SDK and JavaScript
975
Translate
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

correct answers 1 Correct answer

Community Expert , Mar 28, 2018 Mar 28, 2018

Use this:

util.printf("%,3.2f",event.value*100);

Translate
Community Expert ,
Mar 28, 2018 Mar 28, 2018

Use this:

util.printf("%,3.2f",event.value*100);

Translate
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
Explorer ,
Mar 28, 2018 Mar 28, 2018

This worded perfectly.

Thank you very much!

Translate
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
Explorer ,
Mar 29, 2018 Mar 29, 2018

Hello Try67

I was wondering if you could help me a little further with this script.

This is the comment I received back from the Translator on my 1,5 %

If I type a percentage with a comma, the percentage disappears.

If I type it with a period, the percentage converts into French format with a comma.

Could we have it set so that both a comma or a period can be used when typing a percentage and still appear in French format in both cases?

Try67, is this possible?

Again your help would be greatly appreciated.

Translate
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 29, 2018 Mar 29, 2018

That would require a custom-made Format and Keystroke script.

On 30 March 2018 at 00:28, marilynr59152174 <forums_noreply@adobe.com>

Translate
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
Explorer ,
Mar 29, 2018 Mar 29, 2018

Should I post as a new question?

I currently have this Custom format script

if (event.value !=="" && !isNaN(event.value)){

event.value = util.printf("%,3.2f",event.value*100);

}else{

event.value = "";

}

But nothing in the Custom keystroke script.

Validate tab, Run custom validate script

if (event.value !== "") {

event.value = event.value / 100 ;

}

if (event.value>1||event.value<0)

{

event.value="";

app.alert("L’entrée doit être entre 0 et 100")

}

Thanks again

Translate
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 30, 2018 Mar 30, 2018

Basically you would need to replace the comma in the new value with a period to achieve it.

Translate
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
Explorer ,
Mar 30, 2018 Mar 30, 2018
LATEST

Unfortunately that doesn't work.

The person filling out the form may enter 1.5 percentage in English (with period) or 1,5 French (with comma) and the end result should be a French Percentage as it is a French form.

Currently if a French person enters French percentage 1,5 and the tab or enter key the field becomes blank.

Translate
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 30, 2018 Mar 30, 2018

app.alert("L’entrée doit être entre 0 et 100")

Ça ne répond pas à la question posée mais tu devrais faire très attention aux caractères accentués dans les messages d'alerte (entre autres).

Il faut absolument que tu lises cet article : https://www.abracadabrapdf.net/?p=633

Sous peine d'obtenir ça :

ascii.png

Au lieu de ça :

unicode.png


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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