Skip to main content
Participant
October 15, 2018
Answered

Character Count from Fillable PDF?

  • October 15, 2018
  • 1 reply
  • 4314 views

I'm trying to make a smart order form and I'm stuck on a field. I'm pretty sure the answer is "Javascript" but I'm hilariously out of practice with that so I'm hoping you can help!

I need to calculate cost for a personalized item. The cost is based off the number of characters in a string.

So basically it looks like:

Personalization: [fillable text field here]

Character Count: [number of characters in Personalization field]

Total Cost: [$0.50*character count]

I can get the total cost (a simplified field notation) but is there a way to automatically generate the character count?

This topic has been closed for replies.
Correct answer try67

Sure. Use this code as the custom calculation script of the Character Count field:

event.value = this.getField("Personalization").valueAsString.length;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 15, 2018

Sure. Use this code as the custom calculation script of the Character Count field:

event.value = this.getField("Personalization").valueAsString.length;