Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

LockAllFields Script Help

Avatar

Former Community Member

Hi All,

Having some trouble with a LockAllFields script.

I'm trying to make a button which will lock all the fields on a form. I've been using the following script:

myScriptObject.LockAllFields(form1);

This is set to run on mouse up.

I've created a script object in the root (form1) and just called it myScriptObject

Do I need to do anything else with the object at all?

At the moment I'm getting the an error when I press the lock button in Reader (see attached)error.jpg

What do I need to do to get this working?

Many Thanks!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Ok I think I have figured this out. The lock all fields is a red herring. That option you are using is simply adding a comment to the form. Comments cannot be added to a dynamic form. If you save your form as a static PDF then that technique will work whether the fields are locked or not.

Paul

View solution in original post

32 Replies

Avatar

Level 10

Try this script..

xfa.form.form1.access = "readOnly";

Thanks

Srini

Avatar

Level 9

Hi ,

You can set the access of the fields "readonly" while clicking the button . You can use it either in mouseup or in click event .There must be a parent subform . So you can use the following script . I am not sure but I guess it will be of some worth.

rootsubform.access = "readOnly";

Hope it helps.

Thanks.

Avatar

Former Community Member

Many thanks,

Would I need to add a script object under the variables?

And if so, what would it be?

Thanks again.

Avatar

Former Community Member

http://www.arcpropertysolicitors.com/chtestform.pdf

Thats the test i'm doing above. Would you mind taking a look to tell me where I'm going wrong?

Thanks,

Chris

Avatar

Level 10

Here is your corrected form..Check the Click event of the Button. I placed the controls on a body page..

https://acrobat.com/#d=CbKINJFsCkZvgvQatNLBKQ

Few observations..

1) You have used "myScriptObject" in your code but actually you did put a name for your script object. You can check it in Heirarchy..

2) You placed all the controls on the Master Page and the access property was not available for the Master page.

Thanks

Srini

Avatar

Former Community Member

Hi,

Thanks for your help but I'm still getting an error:

error1.jpg

Avatar

Level 10

In the form I sent you earlier, follow these steps..

1) goto the Click event of the button and Change the language to "Java Script"

2) Remove all the code in the click event and place the below line..

     myScriptObject.LockAllFields(form1);  

3) Save the form as Dynamic XML Form instead of Static.

Here is the updated form..

https://acrobat.com/#d=PDEhdSHGdss-qMJer*BHuw

Let me know if you still have issues..

Thanks

Srini

         

Avatar

Former Community Member

Thanks Srini,

Unfortunately I'm no longer able to draw my signature on the form in Reader after extending the permissions through Acrobat Pro - have you changed some of the settings to prevent this?

I'd like clients to be able to complete the form, lock it and then sign it.

Thank you.

Avatar

Level 10

That is probably because the script was locking all the fields on the form including the signature field.

Why don't you try moving the code from the click event of the button to postSign event of the Signature Field..That can help..

Thanks

Srini

Avatar

Former Community Member

Srini,

Many thanks for the suggestion but the problem is that Acrobat is not allowing me to extend the license so that Reader users can sign the form.

In the past I've never used a signature field, we've just been able to put an ink signature anywhere on the form, even if it's already been locked.

Avatar

Former Community Member

You have to Reader Extend the form to allow signatures to be used in Reader. Also the sig field must already exist before Reader opens it. You can Reader Extend in Acrobat to allow this.

Paul

Avatar

Former Community Member

Hi Paul,

I've Reader Extended the form in Acrobat but it's not working correctly.

I can't even add an ink signature in Acrobat...

Avatar

Former Community Member

Just found this on the help pages...

Note: You cannot add an ink signature to a PDF created in LiveCycle Designer ES or the LiveCycle Form Server. PDFs created from those sources do not allow comments and markups.

Could this be the cause of the problems?

Avatar

Former Community Member

You canadd a signature field in Designer (this is just a place holder). It becomes a real signature when the disgner makes the pdf.

Paul

Avatar

Former Community Member

Hi Paul,

I take it this is just a digital signature field - I can't find any way to allow the user to apply an ink signature (in Reader) to a form that was designed in LiveCycle and then extended via Acrobat.

Chris

Avatar

Former Community Member

Do you mean using a signature pad to apply the signature to the field?

Paul

Avatar

Former Community Member

No signature pad, just using your mouse to apply/draw an 'ink signature'.

I'm able to do it on forms that aren't designed in LiveCycle i.e. I've built a test form in Acrobat and extended permissions to Reader and the user was able to apply an ink signature.

Unfortunately, when I add the script to lock the form (which I have to use LiveCycle to do) it removes the option to extend the ink signature permission to Reader (can only allow digital signatures).

Avatar

Former Community Member

So if you do not lock the fields ....will it sign for you?

Paul

Avatar

Former Community Member

If I do not use LiveCycle to create the Lock All Fields button I can draw all over it (in Reader).

If there was some way of using Acrobat to create the locking button, I think that would be the best solution.

Avatar

Former Community Member

So when you say draw all over it you are not simply drawing on the signature field? Are you using a tool on the commenting toolbar to do the drawing?

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----