• 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 replace comma with dot in form field

New Here ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

I'm trying to create a field in a PDF that might contain decimal numbers and calculates this field with another field. As an example, when I write 2.3 in the fillable field, the equation works, but when I write 2,3, the result is NaN. I want to replace the comma I wrote in the field with a dot, or if there is some other workable solution to make this calculation work, I exept all solutions. I have tried with JavaScript (value.replace (/, /, '.')) But I can not make it to work or I'm placing it to a wrong place or something. Please notice that I'm not good at coding.

 

Can anyone help with this?

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

3.6K

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

correct answers 1 Correct answer

Community Expert , Mar 09, 2021 Mar 09, 2021

If you want to write , and field to show , but to calculate as decimal try select this option:

Izrezak.PNG

Votes

Translate

Translate
Community Expert ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

Why not simply use the built-in Format option that has a comma as the decimal separator? That will allow you to enter the value directly with the comma, and will handle it correctly in later calculations.

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
New Here ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

Tried that. If I write 2,3 it gives me back 23.00? 

 

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 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

What option did you select under the Format tab?

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 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

Also, make sure to remove the code you applied earlier, which removes the comma from the text...

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
New Here ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

Thanks for your tip. Actually right now all the Format tab options calculate right??? Nesa Nuranis code workes also. I don't know what happened, but thank you for your tips. 

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 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

That's exactly what I suggested you do, but OK...

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
New Here ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

Yep, it just didn't work the first time I tried it. Maybe closing and re-opening the file did something and this suggestion started to work. 

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 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

So you want to write 2,3 but field to show 2.3?

try this as custom format script:

event.value = event.value.replace(",",".");

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 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

If you want to write , and field to show , but to calculate as decimal try select this option:

Izrezak.PNG

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
New Here ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

Is there a way to edit all fields at once? Because if I choose more than one field the window "format" doesnt show up, only when I choose a single field.

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 ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

LATEST

Not manually. It can be done using a script, though, like this (paid-for) one I've developed:

https://www.try67.com/tool/acrobat-apply-format-to-multiple-text-fields

 

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
New Here ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

This worked perfectly. Thank you very, very much!!

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