Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

round up Javascript in Adobe Acrobat

round up Javascript in Adobe Acrobat

round up Javascript in Adobe Acrobat

Hello - I need help with writing a javascript to round up a field.  I've converted an Excel form to a PDF, and in the Excel form, the code used is:  =ROUNDUP(H32, -3)

What I have is 2 fields.  One field called Subtotal.1 is the actual total dollars, and the other field called RSubtotal.0 is the 'round up' of Subtotal.1.  

Does anyone know what the javascript code would be for this?


RE: round up Javascript in Adobe Acrobat


will round up to 2

RE: round up Javascript in Adobe Acrobat

I tried this and it didn't work????

RE: round up Javascript in Adobe Acrobat

What is the exact code you used? Where did you place the code?

Based on the names of your fields, this works for me in the 'Calculate' event of the RSubtotal.0 field

event.value = Math.ceil(this.getField("Subtotal.1").value)

RE: round up Javascript in Adobe Acrobat

Hello Mark Walsh

This worked pretty good, however, the owners would like the field to round up - for example, if the Subtotal.1 is $9,144, RSubtotal.0 rounds up to $10,000.00, is this possible?

Thanks Much
Connie Bretes

RE: round up Javascript in Adobe Acrobat

If you're trying to round up to the nearest 1000, then try this:

event.value = Math.ceil(event.value/ 1000) * 1000

RE: round up Javascript in Adobe Acrobat

Hello Mark and others:

Does anyone know if a good book to purchase that covers Adobe Acrobat and Javascripts like what was covered above?  

RE: round up Javascript in Adobe Acrobat

There aren't too many books that cover Acrobat javascript, other than the Adobe guides:


These mostly cover the Acrobat-specific context. For more generic Javascript context, there are many books, I have the O'Reilly book:


Also, often when looking for specific context, I just use google to find what I am looking for instead of pulling out the book.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close