5 Replies Latest reply on Jun 25, 2008 6:02 AM by Bernd Alheit

    Blinking required form field

    jay fresno Level 1
      Someone described to me a form that they saw in which required form fields blinked until filled out. Since I didn't see the form myself, I'm wondering if the blinking was done using a separate object or if it was a Javascript built into the form field itself.

      Does anyone know of a script that could be used to create blinking fields?
        • 1. Re: Blinking required form field
          jay fresno Level 1
          Adding to my topic, the text field should blink if it is blank, but stop blinking once it has some text in it.

          John Deubert has a blinking script, and I found another script that changes the color of form fields when they are not blank. But I'm not able to put the two scripts together so that the the fields blink when blank and stop blinking when they have text in them. The two scripts are below. Can you help?

          BLINKING

          var btnOn = false // Create a Boolean variable, set it to false
          function ToggleButton() // Start of a function definition
          {
          var btn = this.getField("Text") // Get the button Text.1 and Text.2
          btnOn = !btnOn // Reverse the value of btnOn
          if (btnOn) // Is btnOn now true?
          btn.fillColor = color.red // Yes: set the buttons color to red
          else // Otherwise...
          btn.fillColor = ["colClear", 0, 0, 0] // Set the color to Transparent
          } // End of our function
          // Now turn on the blinking:
          if (app.viewerVersion >= 5) // But only if our Acrobat is version 5 or later
          var blinkObject = app.setInterval("ToggleButton() ", 1000)

          CHANGE COLOR WHEN FILLED

          //ifFilled - Document JavaScript
          function ifFilled(){
          if ((event.target.value > "") && (event.target.type == "Text")) {
          event.target.fillColor = colClear;
          }
          }
          • 2. Re: Blinking required form field
            gkaiseril MVP & Adobe Community Professional
            Do not foreget to turn the interval timer off when the PDF is closed!!!

            If you do not it will consume some resouces and may interfer with other Acrobat files that maybe opened.
            • 3. Re: Blinking required form field
              jay fresno Level 1
              Thanks, Geo. The blinking is turned off with a Will Close document action:

              if (app.viewerVersion >= 5)
              app.clearInterval(blinkObject)

              ---------------
              I've made a slight amount of progress on this project. The BLINKING JavaScript is the same as above.
              The CHANGE COLOR script has been eliminated.
              For each text form field Action, it is the following:
              if (app.viewerVersion >= 5)
              app.clearInterval(blinkObject)

              //ifFilled JavaScript
              function ifFilled(){
              if (event.target.value > "") {
              event.target.fillColor = color.transparent;
              }
              }

              ------------------
              This works (fields blink when blank and stop blinking when they are filled out) -- except for one thing. When one blinking text field is filled out, all blinking text fields stop blinking. I need to have each field acting independently. The empty fields need to continue blinking until they are filled out.

              I haven't been able to figure out the syntax to control each text form field individually. If anyone can offer a suggestion, I'd really appreciate it.
              • 4. Re: Blinking required form field
                jay fresno Level 1
                Since there's been no reply, I'm wondering if it is even possible to do what I'm asking?
                • 5. Re: Blinking required form field
                  Bernd Alheit Adobe Community Professional & MVP
                  You must check all required fields before calling clearInterval.