Skip to main content
Participating Frequently
January 11, 2021
Answered

Decimals showing when clicking in numberbox

  • January 11, 2021
  • 2 replies
  • 1350 views

I've made a calculating pdf in Adobe Actrobat Pro. I've made textboxes with the number feature and choosen showing 0 decimals. If i write 307 in the first box it's supposed to multiply by 0,123456 in the second box. It works and shows the number 38 with no decimals. I have no trouble with calculating. The problem though is when i press the second box with the number 38, it shows 37,900992. We don't want it to show the decimals as it's not imortant for the costumers... and also it dosen't look good.

 

Is there any way to get the decimals in the second box to dissapear when clicking in the box?

This topic has been closed for replies.
Correct answer try67

OK, then change it to use the following code as the custom calculation script:

 

event.value = (Number(this.getField("Text1").valueAsString) * 0.123456).toFixed(2);

2 replies

try67
Community Expert
Community Expert
January 11, 2021

You need to change the field's actual value. The Format setting doesn't do that. It just changes how it is displayed. Which is why when you click into it it reverts to the actual value, the ones you're seeing.

In order to round it to 2 decimals you will need to perform the calculation using a script.

How are you currently doing it?

Alternatively, you can set the field as read-only, but keep in mind that doing that will still preserve the old value, just not show it.

L0D445Author
Participating Frequently
January 11, 2021

Currently I'm using the Simplified field notation and typing Text1 * 0.123456.

I have read only already an you can still click on the box and mark the text but you cant edit it.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 11, 2021

OK, then change it to use the following code as the custom calculation script:

 

event.value = (Number(this.getField("Text1").valueAsString) * 0.123456).toFixed(2);

L0D445Author
Participating Frequently
January 11, 2021

Adding this pictures to clearify my question.