Skip to Content
Author's profile photo Siva rama Krishna Pabbraju

Adobe form Password protected with Java script

Summary:  Password protection for Adobe Form with Java Script

Approach:

1.Go to Transaction SFP

SFP.jpg

2. Create a form

Create a Form.jpg

3. Go to Layout and create a text on Master page as shown below

Decalre Text.jpg

4. Create Password check for adobe form

->Go to the Initialize event of DATA as shown below

Write Java code.jpg

->Write down below code

//Decalre variables
var a=1;
var b=2;
var password;

//Prompt for password from user to open the adobe form
password = xfa.host.response(“Enter the Password”,”The title”,”123″);

//Check for Correct password
{
if (password == “123”)    // In this case Password id hard coded to 123
{
  xfa.host.messageBox(“Right password”,”You Know right”,3,0);
  a = 1;
  b = 1;
}
else
{
  xfa.host.messageBox(“Wrong password”,”You know ur Wrong”,1,1);
  a = 1;
  b = 2;
  password = xfa.host.response(“Enter the Password”,”The title”,”123″);
}
}
while( a != b );

5. Now execute the form

  -> Do not forget the mark Fillable of Form I/P as ‘X’

Test form.jpg

Mark Fillable.jpg

and execute.

Now, Adobe form will ask for password as shown below

Fill pop for password.jpg

Till correct password is enetered this pop up will appear. We can download this form and try to open still password protection will be vaild.

Drawbacks:

->Password is harcoded, I do not how to check with an value from table or rule dynamically

->I ain’t any good in Java scipt, hence could not hide password ( genrally it works with form calc)

Assigned tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Pallavi Garrepally
      Pallavi Garrepally

      Hi Siva Rama Krishna,

      I have tried the above example, when I fill the parameter Fillable = 'X', I get exception as below:

      Exception       SYSTEM_ERROR

      Message ID:          FPRUNX                     Message number:           001

      Message:

      ADS: com.adobe.ProcessingException: com.adobe.Processin(200101)

      Kindly advice.

      Author's profile photo Siva rama Krishna Pabbraju
      Siva rama Krishna Pabbraju
      Blog Post Author

      Hi Pallavi,

      Check below thread.
      https://archive.sap.com/discussions/thread/924345

      Regards,
      Siva

      Author's profile photo Former Member
      Former Member

      i tried the above steps but not successful. Can you send me the details please.

      Author's profile photo Siva rama Krishna Pabbraju
      Siva rama Krishna Pabbraju
      Blog Post Author

      Hi Safel,

      Can you please post error screenshots or please let me know where did you got stuck ?

      Regards,
      Siva

      Author's profile photo Former Member
      Former Member

      Thanks all.. I have solved it...

      Author's profile photo Former Member
      Former Member

      Dear Siva Ramakrishna,

      with code provided its not allowing to close the application if at all with wrong password. and if I click Esc on keyboard its giving java script debugger pop-up and then allowing to access the document. any solution you suggest?

      Author's profile photo Siva rama Krishna Pabbraju
      Siva rama Krishna Pabbraju
      Blog Post Author

      Hi Sateesh,

      The intention of the code is not to display form if wrong password has been entered.

      You have to enter the right password to display form, else we need to close it.

      We can click on Cancel and close the adobe form.

       

      Regards,

      Siva.P

      Author's profile photo Former Member
      Former Member

      Dear Muhammed Safel, can you tell how you solved the issue ?

       

      Author's profile photo Simson Kumar
      Simson Kumar

      Hi Siva,

      Did u get any solution to pass dynamic value ?

      Regards,

      Vipin

      Author's profile photo Abhilash Pradhan
      Abhilash Pradhan

      Thanks Siva for the nice blog.

       

      If anyone is facing the error

      Exception       SYSTEM_ERROR

      Message ID:          FPRUNX                     Message number:           001

      Message:

      ADS: com.adobe.ProcessingException: com.adobe.Processin(200101).

       

      Use the settings below while calling the Adobe Form .