Skip to main content
Known Participant
March 1, 2019
Answered

how to show number in inches

  • March 1, 2019
  • 1 reply
  • 647 views

I created a field to enter a number like this, 1 5/8 or 1 7/8 to 2 7/8 etc. I would like to not have to type in the " mark every time. I have this javascript that does what I want, but to whole numbers not fractions. Take a look a this script and perhaps it can be modified to get the job done.

my code (in the Custom Format)

AFNumber_Format(0,0,0,0,"\''",false);

I''ve tried to play around with it a little bit but couldn't get it. If you know, please let me know? Thanks.

This topic has been closed for replies.
Correct answer Thom Parker

So, "5/8" is not a number, it's text, so you have to use text formatting. As it turns out this is extremely easy.

Use this as a custom format script.

if(event.value.length)

    event.value += "\"";

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
March 1, 2019

So, "5/8" is not a number, it's text, so you have to use text formatting. As it turns out this is extremely easy.

Use this as a custom format script.

if(event.value.length)

    event.value += "\"";

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
pdfUser1Author
Known Participant
March 1, 2019

hi Thom, that was fast. Thank you. That's what I wanted.

I also wanted to talk to you about your stamp book. I'm playing around with them and have successfully made some. They're simple static ones though. But, I'd like to create the dynamic types. Does your book show how to create them? I mean like the source code and examples? I've seen these stamps (I think they were stamps) on the internet where there's an interface that have drop downs and can import info from Excel spreadsheets and all kinds of neat things. Does your book go into this kinds of advanced scripting? Would you have any other examples other than your short demo video on your site? I'd like to really spend more time checking it out.

Thom Parker
Community Expert
Community Expert
March 1, 2019

Yes the book covers many advanced scripting techniques for Dynamic stamps, that was kinda the point. You'll also find more info and examples at www.pdfscripting.com.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often