2 Replies Latest reply on Jan 12, 2010 8:57 AM by Themistoklis Chapsis

    AcroForm Text field - Advance formating

    Themistoklis Chapsis

      Hi dear all,

      I have to create an acroform and I need a text field with specific text formating.


      Scenario a:

      Lets suppose that the user is typing the amount: 1.250,00 (double zero decimals) or 1.250 (no decimals).

      Is it possible to change the amount to €1.250,- using javascript or other language?

      (add the curency symbol AND replace the 2 decimals with the minus symbol or N dash symbol)


      Scenario b:

      The user is typing the amount 1.250,75 (2 decimals).

      Is it possible to change the amount to: €1.250,75 using javascript or other language?

      (change the text size of the 2 decimals in order to appear shorter OR alternativelly apply a different font* at the 2 decimals)

       

      *a custom font that I have already create with shorter characters in order to appear visually the way I need at the form field

       

      Thank you in advance for your help.

       

      Kind regards,

      Themis

        • 1. Re: AcroForm Text field - Advance formating
          gkaiseril MVP & Adobe Community Professional

          You could look at the 'Rich Text' enabled text field. You should be able to use the 'span' object to modify the 'Rich Text' enabled field to use properties of the 'span' object to control the size of the font or use subscript or superscript. A 'Rich Text' enabled field is not the 'RTF' type format. You will have to write some Acrobat JavaScript code to perform the formatting.

           

          You should download the Acrobat JavaScript API documentation.

          1 person found this helpful
          • 2. Re: AcroForm Text field - Advance formating
            Themistoklis Chapsis Level 1

            Hi, thank you very much for your reply.

             

            I've manage till now to find a solution for my first problem (scenario a) with a custom Key stroke script:


            event.value = event.value.replace("","€"); // add the euro symbol before the field value

             

            event.value = event.value.replace(",00",",-"); // replace the double zero decimal with ,-

            event.value = event.value.replace("€€","€"); // if the input has already the euro symbol, keep only one

             

             

            I know that it's not rocket science but since it works and I am a javascript rookie I'm happy with that.


            Now, about the second issue (scenario b) and your answer. I have no idea how to proceed but you gave me a start point and a couple of keywords so I guess I'll figure out something. Of course every help, is always more than welcome.


            Again, thank you very much!

             

            Kind regards

            Themis