@yanksgirl thanks for confirming the details.
When a value is pushed into a field by an import or by an external system (your Core), Acrobat does not fire the same field events it fires when someone types and tabs out. So the Validate event and the Calculate event cannot be relied on to run on a Core-populated value. A validation or calculation script is not the tool for this.
Because the value only needs to look right on the rendered line and is not used anywhere else, the cleanest fix is a Custom Format script. A Format script changes only what is displayed, not the stored value, which is exactly what you want here. Your Core keeps sending "1.99%", the field still stores "1.99%", but it draws "1.99", and your static "%" then reads correctly as "1.99%". No extra calculated field needed.
Steps in Acrobat Pro:
- Open All tools > Prepare a form.
- Right-click
AP_1_INTEREST_RATE and select Properties. - Open the Format tab.
- Select Custom, then Custom Format Script.
- Enter this one line:
- event.value = String(event.value).replace(/%$/, "");
- Click OK/Close and save.
This strips only a "%" at the end of the displayed value:
- Core sends 1.99%
- Field displays 1.99
- Your existing static % remains
- Final appearance: 1.99%
I would also leave the field's Percentage formatting off, since the "%" is already supplied by your form layout.
Why Format rather than Validate or Calculate: Validate will not reliably run on your imported value (yanksgirl's point, and it is correct), and a Calculation script on this same field would set the field's own value on recalc and fight with what your Core writes in, and it does not fire reliably on import either. The Format event governs the displayed appearance, so it is the right place to hide the extra "%".
Please note that a Format script only redraws when Acrobat regenerates the field's appearance. If the Core populates the field and the file is then opened in Acrobat or Reader, the display should regenerate and you will see "1.99". But if your import path renders or flattens the PDF without Acrobat regenerating appearances, the Format script may not run. If that turns out to be the case, the most robust fix is to strip the "%" at the Core/data-mapping layer so the field simply arrives as "1.99". As an in-document stopgap when the file is opened in Acrobat/Reader, you can force a redraw with a document-level this.calculateNow();, but cleaning it at the Core source is the dependable, viewer-independent answer.
I hope this helps.
Regards,
Anand Sri.