1 Reply Latest reply on Oct 26, 2009 3:15 AM by $Nith$

    Java in Livecycle to check required fields then submit

    pittfan2 Level 1

      Has anyone created a fake email button to check for required fields such as LastName, FirstName, EffectiveDate, EmployeeNo. and then execute an event on a button?

       

      I have a form where I have written Java programming on a button to email the form and include field names (see below):

       

      var oDoc = event.target;
      oDoc.mailDoc({
          bUI: false,
          cTo: test@test.com ,
          cBcc: "bcc@bcc.com; test@test.com" , 
          cSubject: "PNF for " + LastName.rawValue + ", " + FirstName.rawValue + " : Reason - " + ReasonforChg.rawValue + " (" + ReasonCodes.rawValue + ") "

       

      I would like to keep this but have lost the check for required fields since I am not using it as a submit button.  I am trying to create a button that checks for required fields then executes the script on the button to email the form.

       

      Can anyone help me?

        • 1. Re: Java in Livecycle to check required fields then submit
          $Nith$ Level 4

          Did you try to use the if else construct?

           

           

          if(someField.rawValue == null  || someField.rawValue=='')

          {

           

               app.alert('Please fill the required fields and click submit');

           

          }else{

           

          //your previous lines of code

          var oDoc = event.target;
          oDoc.mailDoc({
              bUI: false,
              cTo: test@test.com ,
              cBcc: "bcc@bcc.com; test@test.com" , 
              cSubject: "PNF for " + LastName.rawValue + ", " + FirstName.rawValue + " : Reason - " + ReasonforChg.rawValue + " (" + ReasonCodes.rawValue + ") "

           

          }

           

           

          Nith