/ Id-Extras Forum / Complex Form Creation – Multiple Levels of Editability

  • Author
  • #6160 Reply

      Here’s the situation: I’m trying to create some forms where certain fields have pre-populated values that can’t be edited by the end user. I also need to do some division, rather than just multiplication and addition, but I do not know JavaScript.

      And then lastly, when I type in Acrobat the text appears black until I click OUT of the form field.

      #6275 Reply

        So, for the first question (1): Create text fields in InDesign and type the value you want. There’s a checkbox in the Buttons and Forms panel in InDesign called “Read Only.” That will lock the field in Acrobat.
        (2) A very basic script to do division would be something like this:

        v1 = this.getField(“Your field name goes here”).value;
        v2 = this.getField(“Another field name”).value;
        this.getField(“Third field”).value = v1/v2;

        Add that to the field called (in this example) “Third field” as a custom calculation script.
        (3) Not sure what you mean about the colour.


        #6276 Reply

          Thank you for the answer to number 1- that appears to be working

          (2)I placed it in place with the appropriate text, but it does not seem to be working. It looks exactly like this:

          v1 = this.getField(“Text Field_7”).value;
          v2 = this.getField(“Text Field_8”).value;
          this.getField(“Text Field 9”).value = v1-v2;

          (I am subtracting in this case, not dividing)

          For what it’s worth, NONE of the calculation fields are working – I’ve even attempted the simple Sum calculation fields and they are not working. I don’t know if this is related to issue #3 below…

          (3) – When I export the interactive PDF and then run Form Maker in acrobat, the text fields DO function as text fields. When I click into them, I can type and you can see the correct styling. So far so good. But if I click OUT of that text field, that content I’ve typed changes color to black, which is invisible on this design. If I click back into that text field, it remains black.

          #6277 Reply

            Could you send me the PDF? I’ll take a look.

            #6278 Reply

              I note that “Text Field 9” does not have an underscore before the “9”, while fields 7 and 8 do. Is that correct?

              #6279 Reply

                Thanks for sending over the PDF.
                So, in Text Field 3 there’s something funny going on. Check out the screenshot.
                The script is broken over 2 lines and things are missing.
                It should look like this:

                // FormMaker-Calculate
                AFSimple_Calculate(“SUM”, “Text Field 2, Text Field 1”);

                In InDesign, select Text Field 3, delete the existing calculation, and try applying it again. Then export as interactive PDF.
                Not sure how that script got corrupted. Perhaps you played around with it in Acrobat?
                Also, the text is not appearing because it is coloured black. Have you applied a white colour to it in InDesign?

                #6280 Reply

                  Thanks, man. I really appreciate all your help.

                  So – ignore fields 1,2,3,13,14,15,16. The client hasn’t explained what “savings” is supposed to mean, and there are no formulas in there anyway.

                  I changed the colors to a background white – the white-styled text wasn’t sticking for some reason.

                  Fields 4,5,6,8,9,10,11,12 are all “read only.” The user can only affect field 7, and the rest of those fields should auto-populate. Even the simple formula for field 9 doesn’t seem to work: https://www.dropbox.com/s/nhz9fmz9wfsfe46/profit_calc_v1.pdf?dl=0

                  #6281 Reply

                    So, there are 2 issues I’m seeing:
                    (1) In field 12 we have the same problem as I mention above in field 3. The script there is broken with that extra line break.
                    If a calculation script has a major syntax error like that in an Acrobat form, it will break the entire form, because all calculation scripts in the form are run every time a value in the form changes. If one of them has a syntax error, the entire form stops working as a result.
                    (2) Field 8. This has a value of “$0.32”. However, $0.32 is not a number (because of the $ sign), so field 9 cannot use it as part of a calculation. The correct way to set this up in an interactive form is to give a value of just “0.32” without the dollar sign. Then, use the formatting options in FormMaker to add the $ sign before the number, and anything else needed. In fact, you’ve done that already. Once you do that, the value is a plain number (0.32), although it will look correctly formatted – $0.32 – and the form should work.
                    Hope that helps, post back if there are any other issues!

                    #6282 Reply

                      Regarding 1) – I understand the “script is broken” – but I don’t know what to do about it. All I’m doing is selecting “product” – do I need to create a custom calculation script instead? What should those scripts be, in these cases?

                      2) Got it.


                      – Josh

                      #6283 Reply

                        Hi Josh,
                        You should delete that script if you’re unsure how to edit it. Then, with FormMaker in InDesign, apply the calculation that you want to field 12 again and export the interactive PDF. Does that work?

                        #6284 Reply

                          In Field 12, that’s exactly what I’m doing. I’m simply selecting “product” of Field 10 and 11, and it populates nothing. You can see the screenshot right here.


                          #6285 Reply

                            Regarding the color issue from earlier – we figured it out. In FormMaker in InDesign, under the Format tab, if you select the “use red text” checkbox, the text will only display in black or red- it ignores your other styles.

                            #6286 Reply

                              Right! It seems this is just the way Acrobat forms work. If “use red text” is selected, Acrobat assumes you’re wanting either red or black text only, and the option to select other colours is greyed out.
                              So, if you want the text in your fields to be some colour other than black or red, you have to make sure “use red text” is deselected!
                              (This is only an issue if, under the Format tab in FormMaker (or Acrobat), the formatting of the field is set to “number.”)

                            Viewing 13 posts - 1 through 13 (of 13 total)
                            Reply To: Complex Form Creation – Multiple Levels of Editability form6
                            Your information: