19 Replies Latest reply on Apr 21, 2008 3:20 PM by (Keely_Worth)

    Calculating amounts in a fillable order form

      I have created an online fillable Order Form (PDF) which I want to add calculations to: here is link to the form -
      http://www.89cwsale.com/wp-content/uploads/2007/12/plastic-card-online-order-form.pdf
      My javascript knowledge is very limited.

      I have a few different types of calculations I need to do.

      1. Total how many items and multiply this number by $399 (the price)
      2. Same again, but multiply by $8.90 (the price)
      3. Add number 1 to number 2 (easy)
      4. Add $25 for freight if order is under $100
      5. Add tax (multiply total order by tax rate)

      Easy to do the first type of calculation in Adobe ("Value is the"), but when I try to use Simplified Field Notation, nothing works, which I need if the calculation is not basic.

      For the first calculation, I did this:
      (item1+item2)*399 - where Item1 is the field name

      It doesn't work.
      No idea what I am doing wrong.

      Point 2 will be the same principle.

      Point 4 is an "if" statement, I assume:
      "If sub-total is less than $100, then add $25"

      Point 5 is just another multiplication, but I am obviously not putting the correct syntax in for multiplication.

      It is probably fairly easy, once you know how - I have done many Google searches for Simplified Field Notation, but there isn't much out there - or I haven't managed to find it.

      All help appreciated.
        • 1. Re: Calculating amounts in a fillable order form
          gkaiseril MVP & Adobe Community Professional
          Have you looked at the JavaScript documentation?

          Have you studied any other forms?

          1., 2. You have a very lengthy form with numerous similar fields, so learn about hierarchical fields. You will be able to automate by control loop the summing of the fields or use the "the ____ of" to total the fields with the same high level name into a hidden field and then multiply the total in the hidden field by 399 or 8.9. If you insist on the "Simplified field notation", do not use only numbers as the field name. you should start the field name with a alphabetic character so Acrobat knows it is not a number.

          3. If you think so! There is a trick to hiding zero when there is no data on the form.

          4. You can not use "if" statements or other control statements in with the "simplified field notation" option.

          You can make your check boxes mutually exclusive by naming all buttons within a group with the same name and changing the export values.
          • 2. Re: Calculating amounts in a fillable order form
            Level 1
            Yes, I have searched for information about javascript in adobe forms, but not getting much that helps, so I found this forum in the hope that someone could get me started.

            I am not too good at javascript, so what you have written is not clear/helpful to me at all, though I do appreciate the comments.

            Can you give me the javascript I need - I have no idea how to do it. If I feel it necessary, I will learn javascript - but at this stage, I need the form to be able to calculate for me, ASAP.

            Many Thanks
            • 3. Re: Calculating amounts in a fillable order form
              Level 1
              For example - you say for point 3 " If you think so! There is a trick to hiding zero when there is no data on the form"

              How is this done - that's what i need.

              Thanks.
              • 4. Re: Calculating amounts in a fillable order form
                DimitriM Level 3
                Hi Keely,

                It may be that you have not searched hard enough, or put in the time and effort that IS required for completing your form. Have you looked at all the resources available FREE to you at acrobatusers.com? In particular there is a section of that site called JavaScript Corner with many downloadable PDF examples with scripts for many of the things you are asking people here to spend time and effort for FREE. I'll go out on a limb and assume that you are getting paid a wage for this project. Why would you expect someone with skills you currently lack to not make a wage for their work? Not trying to offend here, but "user to user" forums are for general help and guidance on specific point questions where you get stuck using Acrobat, not for asking people to spend hours doing free work on a form such as yours. JavaScript, as any other programming language, is a skill that will take study, time, and effort on your part. Then, when you have a specific point question on a problem, this is a great place to receive help on getting over those humps.

                Best of luck with your project,

                Dimitri
                WindJack Solutions
                www.windjack.com
                • 5. Re: Calculating amounts in a fillable order form
                  Level 1
                  Dimitri,

                  I was quite stunned by your response - I was offended by it.

                  I have searched a LOT; but I don't want to waste time telling you off.
                  I know the amount of time I have spent trying to work out how to do this, then found this forum, in the hope it would at least get me started.

                  Your attitude is unnecessary, Dimitri.

                  Did you get out of the wrong side of the bed this morning?
                  • 6. Re: Calculating amounts in a fillable order form
                    gkaiseril MVP & Adobe Community Professional
                    You have been given information about how to start to fix your problem. You have used a poor field naming convention if you are going to use the "Simplified field name option"!

                    You are programing and the language syntax and grammar are far more important than in conversational language.

                    To suppress zero when using any calculation script is to use the following script in the field's custom validation script"

                    if(event.value == 0) event.value = "";

                    Acrobat Documentation:

                    Developer center http://www.adobe.com/devnet/acrobat/

                    Acrobat JavaScript documentation: http://www.adobe.com/devnet/acrobat/javascript.html

                    Acrobat User's Community - JavaScript tutorials: http://www.acrobatusers.com/tech_corners/javascript_corner/index.php

                    PlanetPDF Developer learning Centers: http://www.planetpdf.com/developer/learning.asp

                    Books about Acrobat JavaScirpt: http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=13771

                    Both Acrobat User's Community and Planet PDF have extensive forums about programing Acrobat forms.

                    Your post is asking for all the programming to complete your project that you are being paid for or will be used to make your living and you expect others to give you their knowledge and skills for free???!!!

                    Acrobat provide some wonderful JavaScript examples with the full professional version, if your understand how to Acrobat works and can follow the code.
                    • 7. Re: Calculating amounts in a fillable order form
                      Level 1
                      To both respondants:

                      My intentions were never what you are saying.

                      I have searched and searched for information on how to get started with adobe scripting, without luck. Please don't falsely accuse me without knowing me.

                      I didn't just find this forum wanting answers to how to do what I need; I wanted to express the calculations I needed to show what my issues are, and take any and all advice. As my javascript is minimal, I wasn't understanding the responses. I am getting attacked yet again - that doesn't help anyone.

                      I found Planet PDF as I was only getting attacked here and not getting anywhere. They helped me, without being rude once.

                      Thankyou for all the links. I have saved them, and will continue to research the javascript.

                      By the way - all I needed was (TextField1 + TextField2 + TextField3)*399 for point 1. Planet PDF explained that simplified notation in Adobe is very similar to doing a normal maths equation. That has got me started at least. Maths I am good at. I share what I know at other forums, just to help people who are stuck. I don't care if they . . . .

                      "are being paid for or will be used to make a living and they expect others to give you their knowledge and skills for free???!!!"

                      That is a selfish attitude.
                      • 8. Re: Calculating amounts in a fillable order form
                        DimitriM Level 3
                        Hi Keely,

                        Sometimes what we write is misunderstood. I took-

                        "Can you give me the javascript I need - I have no idea how to do it. If I feel it necessary, I will learn javascript - but at this stage, I need the form to be able to calculate for me, ASAP."

                        to mean you wanted someone to "give" you the scripts for your form. And, that "if" you felt it "necessary" to learn JavaScript you would but for now, you just wanted people here to "give" you verbatim scripts. I am sorry if I, and others, misinterpreted your words.

                        Glad you found Planet PDF helpful, it is a great resource, as are the others Geo Kaiser provided.

                        Best of luck with your project!

                        Dimitri Munkirs
                        WindJack Solutions
                        www.windjack.com
                        • 9. Re: Calculating amounts in a fillable order form
                          Level 1
                          Read my first post, smartarse.

                          I said . . . "No idea what I am doing wrong" and then "It is probably fairly easy, once you know how - I have done many Google searches for Simplified Field Notation, but there isn't much out there - or I haven't managed to find it.

                          All help appreciated"

                          So go suck on that, pal.
                          • 10. Re: Calculating amounts in a fillable order form
                            Level 1
                            First post was me - second post was me getting frustrated. I have been searching for adobe javascript help for 2 fn weeks. Once I learn how to do it, I will be posting it on my website to help others, so go shove a sharp stick up your behind.
                            • 11. Re: Calculating amounts in a fillable order form
                              Level 1
                              No further comments required; sarcasm is the lowest form of wit.
                              • 12. Re: Calculating amounts in a fillable order form
                                Level 1
                                And you're a female, Dimitri.

                                Shame on you. You should know better.
                                • 13. Re: Calculating amounts in a fillable order form
                                  Level 1
                                  "Best of luck with your project!"

                                  Do you mean "I will abuse you, then be sarcastic" ??????

                                  I found what I needed, no thanks to you people.
                                  • 14. Re: Calculating amounts in a fillable order form
                                    Patrick Leckey Level 3
                                    Ok, whether happy or not the issue is solved, no need to spam the forums with venom for the rest of us who were not involved. Be adults and just go your separate ways.
                                    • 15. Re: Calculating amounts in a fillable order form
                                      Level 1
                                      Enough, PDL. Give it a rest.
                                      • 16. Re: Calculating amounts in a fillable order form
                                        Patrick Leckey Level 3
                                        Considering that's my first post on this thread, and I was in effect asking you to "give it a rest", I think my resignation from the situation is implied. Hopefully you can move on too.
                                        • 17. Re: Calculating amounts in a fillable order form
                                          Level 1
                                          You people are unbelievable??

                                          PDL - there was no need for ANY comment from you.
                                          So stop commenting, for God Sakes.
                                          • 18. Re: Calculating amounts in a fillable order form
                                            Patrick Leckey Level 3
                                            I'm just trying to stop a flame war on a forum that is normally quite professional. So there was a reason for my comment.

                                            You are the one trying to egg people on here. You could have stopped posting at any point as well, yet you decide to respond to a simple request to stop the animosity with a venomous response, and to someone who had absolutely nothing to do with your original post and has in no way wronged you.

                                            If you cannot bring yourself to act like an adult that is your decision. Continue your spiteful posts as it really means quite little to everyone. I've said my piece and asked for peace, to which you seem hellbent on disrupting. That is your choice. Flame away, this will be the last post in an effort to stop this descent.

                                            I will not be drawn into your juvenile game no matter how mad you are at the entire Acrobat community because one user was, quite arguably, mean to you.

                                            So stop commenting, for God's sake.
                                            • 19. Re: Calculating amounts in a fillable order form
                                              Level 1
                                              I am not "flaming", merely expressing my dislike of the comments that have been posted.

                                              If you think that is "venomous", that's your opinion. But why interfere.
                                              You are the one continuing to antagonise me.

                                              As I said earlier, stop commenting and get a life. I am trying to work, thanks.