7 Replies Latest reply on Jan 4, 2018 8:54 PM by pdfUser1

    Check this script (Gilads' script)

    pdfUser1 Level 1

      I'm using this script to show/hide a field on a timer, and it works fine, but now I'd like to have the field remain visible if populated (it's a drop down). Here's the script I'm using:


              if (util.printd("",new Date())=="") {


          var timeout = app.setTimeOut("this.getField(\"Text16\").display=display.hidden;", 15000);

      } else this.getField("Text16").display=display.hidden;


      I have this attached to a popMenu button. Is it possible to continue to use this script but to add a bit to cancel out the timer when Text16 is populated? It'll then go back to hidden when reset or when blank. Thanks guys

        • 1. Re: Check this script (Gilads' script)
          try67 MVP & Adobe Community Professional

          The first line doesn't make sense. What are you trying to do there?

          • 2. Re: Check this script (Gilads' script)
            Thom Parker Adobe Community Professional

            You can do this by making the timeout script a little more complicated.  Try this:



            var timeout = app.setTimeOut("if(this.getField(\"Text16\").value == \"\") this.getField(\"Text16\").display=display.hidden;", 15000);


            And as Try says, the first line code (the if) doesn't do anything, you can delete it.


            • 3. Re: Check this script (Gilads' script)
              pdfUser1 Level 1

              I'm sorry, I didn't make it clear. When you originally helped me with this bit of script it was back when the AUF was open for q's and a's. I asked for help to show a field on hide a field on a specific date. Well, I still don't know javascript well enough, but I can play around with it well enough to, at times, to modify a working script. I deleted the date info and the script still worked so I left it in, but I didn't know what I was doing and why. So, the script works to show and hide the field.


              But now, I would like to show the field and if I make a selection from the drop down it would stay visible. Keeping the timer command, of course, it would go hidden if the drop down field was blank or on Reset after the allotted time. I played around with a bit of show/hide coding but this time I can't figure it out.


              I tried the script Thom provided and it worked (somewhat). The field stayed visible after I made a selection from the drop down. But, not on Reset or clear. It remained visible. I'd like the field to go hidden on reset or clear or blank like it does with the timer script.

              • 4. Re: Check this script (Gilads' script)
                pdfUser1 Level 1

                What I'm trying to do is, perform a calculation that this drop down is a part of at times (when needed). If I need it I select to show it and when I don't I hide it because I have too many fields and hiding it makes room because I don't need it.

                • 5. Re: Check this script (Gilads' script)
                  pdfUser1 Level 1

                  Thom, thanks for trying to help. The code you provided kinda works but if I make a selection and reset the field the field stays visible. And also when (after) I make a selection and clear the field it still stays visible. It should go hidden.

                  • 6. Re: Check this script (Gilads' script)
                    Thom Parker Adobe Community Professional

                    The script I provided does exactly what you asked.  Changing the visibility for other actions is a different issue. You've got a somewhat complicated process here.


                    You do an enormous amount of PDF scripting.  And have been for a very long time now. You really aught to have learned more about scripting than you have. I would suggest you do just that. Spend some time and actually learn about this. Or hire someone. You do enough of this that it would be worthwhile.

                    • 7. Re: Check this script (Gilads' script)
                      pdfUser1 Level 1

                      You're absolutely right, Thom. I enjoy working with this program and even more so when I can get a feature to work. It's a bit confusing to understand it though. I learn a great deal from these forums and stay interested because of the help I find here and the AUF. Most of the answers to my projects have come from here and I appreciate it. The thing is I wish I had the time to spend learning this stuff. I can say it's not easy to do from books or even spending time on the forums. Javascripting, the terminologies and where each coding goes is a bit daunting to do.


                      I really haven't done an enormous amount of scripting. Perhaps a bit of features to a field or two. Getting a field to do this or that but I've only managed to complete 3 different projects. I wouldn't say that's an enormous amount of scripting.


                      Perhaps, there would have been more if it weren't for my other concerns such as work and health. My background is not in computer programming. Not in javascripting. Whatever I know today is self learned by trial and error (mostly errors). I wish I had the time to go back to school and learn this stuff, I'm talking about the time I have left, but I don't have that luxury. But, I'm not trying to do this for a living or business.


                      Anyway, thank you for your help. You're right. The script you provided does work. All the best to all you guys here. I hope a happy and prosperous New Year.