13 Replies Latest reply on Nov 2, 2017 11:51 AM by Thom Parker

    Input boxes popup before can select stamp - Custom Javascript stamp Acrobat 9

    jeremyd21

      I made a custom stamp that I have been using for a while, it has 7 inputs to type in and with pop up boxes.  My issue is that I have never had it working properly and every time I go near the stamp button the popups for data entry appear before I can choose the stamp.  It gets really frustrating.

       

      I have looked for many hours online but I can't exactly work out which part of the code I'm getting wrong.  I worked out that I needed to get the stamp name from the code (which I've done) but I don't know how to meld the event.source.forReal code with my code!  I also had the javascript calculations seperate for all the boxes with inputs but I've seen that its supposed to work much better if you only have one script.

       

      My attempt at adding the code together is at the bottom.  If anybody can help me out and let me know where I've gone wrong I would greatly appreciate it.

       

      Regards Jeremy

       

       

      code.PNGstamp example.PNG

       

       

      if (event.source.forReal && event.source.stampName=="#lyvn1KW9WUYWKxxaJXcLDA") {

      event.value = app.response

       

       

      var cResponse = app.response({

      cQuestion: "Enter Certification Number",

      cTitle: "Certification Number",

      cLabel: "Certification Number:"

      });

      if (cResponse == null) {

      event.value = "*NVALID*";

       

       

      }

       

       

      else

      event.value = cResponse;

       

       

      var cResponse = app.response({

      cQuestion: "Enter Certification Date",

      cTitle: "Certification Date",

      cLabel: "Certification Date:"

      });

      if (cResponse == null) {

      event.value = "*NVALID*";

       

       

      }

       

       

      var cResponse = app.response({

      cQuestion: "Enter Rating",

      cTitle: "Rating",

      cLabel: "Rating:"

      });

      if (cResponse == null) {

      event.value = "*NVALID*";

       

       

      }

       

       

      else

      event.value = cResponse;

       

       

      var cResponse = app.response({

      cQuestion: "Enter Heating Energy",

      cTitle: "Heating Energy",

      cLabel: "Heating Energy:"

      });

      if (cResponse == null) {

      event.value = "*NVALID*";

       

       

      }

       

       

      else

      event.value = cResponse;

       

       

      var cResponse = app.response({

      cQuestion: "Enter Cooling Energy",

      cTitle: "Cooling Energy",

      cLabel: "Cooling Energy:"

      });

      if (cResponse == null) {

      event.value = "*NVALID*";

       

       

      }

       

       

      else

      event.value = cResponse;

       

       

      var cResponse = app.response({

      cQuestion: "Enter Total Energy",

      cTitle: "Total Energy",

      cLabel: "Total Energy:"

      });

      if (cResponse == null) {

      event.value = "*NVALID*";

       

       

      }

       

       

      else

      event.value = cResponse;

       

       

      var cResponse = app.response({

      cQuestion: "Was it rated with downlights?",

      cTitle: "Rated with Downlights?",

      cLabel: "Rated with Downlights?:"

      });

      if (cResponse == null) {

      event.value = "*NVALID*";

       

       

      }

      else

      event.value = cResponse;

      }