Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

Script to verify fields on form are locked

Avatar

Level 2

Does anyone have any script examples or any links that we could tie in with a pdf submit button to verify all fields are locked before submitting them?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

if (Yourfieldname.access = “open”){

app.alert(“This field is not locked”)

View solution in original post

20 Replies

Avatar

Level 10

Hi,

Have you seen Paul's LockAllFields example? http://forums.adobe.com/message/3864410#3864410.

This uses a function to work through all objects in the form and changes the access property to readOnly.

In your case what action is locking the fields?

You can adapt the function to test that each field in the form is locked, but before going down that route it would help to understand the workflow.

Niall

Avatar

Level 2

I think this is something diffirent.

What we are doing is locking all fields after the user has signed with the signature pad.

We are wanting a script to add to a pdf submit that loks to make sure that the fields are really locked before submission.

Avatar

Former Community Member

The only way to truely know that the field is locked is to have the user access it. The only way programmatically to tell is to interrogate the access property of the field.

Paul

Avatar

Level 2

Sorry, I am a newbie at this.

When you say interrogate the access property of the field, do you mind providing an example of this?

Avatar

Level 10

Hi,

If you have set up a collection for the signature field, then you can specify the fields that are to be locked when the field is signed. This is under the Object > Signature palette. This is the best route and should work robustly. I would be inclined to test the form/signature field using the collection first.

You can test to see if the access property of a field is not "open" and then take appropriate action:

if (Textfield.access !== "open") {

     // field is locked proceed with submission

}

else {

     // field is open, stop submission

}

This is a simple example. A function would need to be set up to run through the whole form.

However, I don't think it will give a good user's experience. For example, if the user fills in the form and signs it and there is an issue with the script. The submission may fail, but the user may not know how to solve it.

I would recommend setting up the collection of fields that you want locked and then test that. No script involved.

Hope that helps,

Niall

Avatar

Level 10

Here is a screenshot of the Object > Signature palette, where I have a collection of fields specified to be locked on signing:

Parallels Desktop1.png

Avatar

Correct answer by
Former Community Member

if (Yourfieldname.access = “open”){

app.alert(“This field is not locked”)

Avatar

Level 2

Thanks so much guys!

Hope you have a wonderful weekend!

Avatar

Level 2

I am getting syntax errors on the below, anyone have any idea on this?

if (EmployeeFirstName.access = “open”){

               app.alert(“This field is not locked”)

Avatar

Former Community Member

Two things ...a comparison between "open" and EnployeeFirstName.access requires two equal signs. Second you need a closing curly brace at the end of your code to close off the if statement. So it should look like this:

if (EmployeeFirstName.access == “open”){

               app.alert(“This field is not locked”)

}

Paul

Avatar

Level 2

Paul,

i just copied and pasted what you said and I am still getting the same syntax error.

Avatar

Former Community Member

My guess is that when you paste the quotes are not represented properly …..retype the quotes and try again.

Paul

Avatar

Level 2

I got the script to get past the syntax.

When executing the form it is not realizing that the doc is not signed.

I have it tied to the pdf submit. Would I come off better tying it to something else?

Avatar

Former Community Member

Locking a field is not the same thing as signing a document ...can you elaborate on what you are trying to accomplish?

Paul

Avatar

Level 2

We have signature pads which are the topaz signature pads.

We want to ensure the document are signed by electronic signatures.

Avatar

Former Community Member

Here is a post that shows how to check if a signature field is signed or not.

http://forums.adobe.com/message/3613741#3613741

Paul

Avatar

Level 2

On this one, did you define the variables you are calling in the subform or how did you do that?

would you be wiling to take a look at what I would need to do to get this working on one of our forms?

Avatar

Former Community Member

Sure I will have a look but I do not have a signature pad to test with. You can send the form via email to LiveCycle8@gmail.com    please include a description of the issue in the email.

Paul

Avatar

Level 2

Email sent to you. Please verify that you do in fact receive it please.

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] ----