2 Replies Latest reply on Feb 28, 2008 10:15 AM by MarkWalsh

    Reset field "Number" format using Javascript

    MarkWalsh Level 4
      I have a PDF form with QTY fields set to format as Number. On startup, I have a Javascript override the format with a custom keystroke function to allow only digits. The fields are originally set with the numeric format in case the user doesn't have Javascript enabled (even though they shouldn't, the user could still type a decimal, although it formats it with 0 decimal places).

      I want to be able to reset the original formatting when the PDF closes, but don't see any way to do this. Are settings like the format and validation settings available with Javascript? Is there an object I can capture on startup with all of the settings for a field that can be reapplied?
        • 1. Re: Reset field "Number" format using Javascript
          gkaiseril MVP & Adobe Community Professional
          You can use the AFNNumber_Function() to set the format of a field in combination with the ".setAction()" field method.

          See Format Multiple Fields, http://www.planetpdf.com/forumarchive/125041.asp , for more information.
          • 2. Re: Reset field "Number" format using Javascript
            MarkWalsh Level 4
            Thanks for the response.

            That link is what I had originally come across. I tried using the AFNumber_Format, but if I'm not mistaken, that still sets the format to a Javascript function. I'm trying to reset the format to "Number" (as if I had selected "Number" from the "Select format category" instead of "Custom" in the interface)

            My goal is to set the PDF up to work without Javascript if the user has it disabled, and enable the javascript functions on startup if they do have it enabled. On closing the document, I want to reset everything to the non-javascript settings so the next time it is opened up by them (or someone else), it will work again if that person doesn't have Javascript enabled. In my limited researching into this, I am starting to think that this is not doable.