14 Replies Latest reply on Jan 9, 2013 4:57 AM by RusticRanger2

    Allow user to password protect a form

    RusticRanger2 Level 1

      I have created a form that asks if the user wants to insert a password - a basic text field. If the password field is empty, then the form opens. If the password exists, then the user is asked for a password - if correct, the form opens for editing, otherwise the form closes.

       

      On the form is a text field called "PWD". The form is called "coal". The script in the Document level is:

       

      var pw = this.getField("PWD");

      if (pw == "") {

      app.openDoc({cPath: "coal.pdf", oDoc: this});

      } else {

           var cRtn = app.response("Please Enter Password:", "Document Control Only");

           if (cRtn != pw){

           app.alert("Incorrect password entered");

           this.closeDoc(true);

           }

           if (cRtn == pw){

           app.openDoc({cPath: "coal.pdf", oDoc: this});

           }

           }

       

      However, this does not behave as I want - anyone know what I have wrong (Damn, I wish I knew more). BTW - I have a Livecycle version that works perfectly, but I need the solution for both.