I have a Java script to make a calculation a percentage:
if (event.value) event.value+="%"
it works great but how to I fix it so it only will calculate to 2 decimal points? And where do I add it ?
I am a total rookie at this.
When you post a question you always need to tell the program you are using
There are MANY programs in a full subscription, plus other non-subscription programs
Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum
@John T Smith is spot on with the information that you need to supply for someone to help you accurately. However, if it's JS that you are using something like the following could work
if (event.value) event.value = parseFloat(event.value).toPrecision(3) + "%"
I am using adobe acrobat pro on a MacBook
Holy guacamole! Thank you it worked !! Yay!!!
Manan had the correct fix
There is no need for script, in field properties, select 'Format' tab then select percentage and select number of decimals.
The problem with doing it like that is that it doesn't actually change the field's value, so if you use it later on in another calculation you might get unexpected results.
Although, the other solution given above has the same issue, of course... You must not use the Format event if you want to avoid this problem.
I tried solving the problem in the format field before reaching out to the forum but it didn't work. The script from Manan Joshi worked perfectly!