Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Lock Fields in subform

Avatar

Former Community Member

I am having trouble getting a Javascript click event button to lock fields in a subform.  I have downloaded Paul's PO form and copied the script but it still didn't work.  I changed the (form1) to my subform name and put the button in subform under the hierarchy but still nothing.  I also saved the form as a dynamic pdf and tried other things that were suggested in other posts but I'm stuck.

Should a myscriptoject variable come up?

When I ctrl+J in the preview pdf tab I get the following error: "myScriptObject is not defined"

What am I missing?

Thanks,

Joe

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Joe,

Paul's example also contains a script object (look in the hierarchy for myScriptObject under Variables). This script object contains the LockAllFields function that is called from the click event of the button. The function does all of the work.

Parallels Desktop1.png

You can drag this script object to your fragment library, which will then make it available to you in other forms. In your form you would drag it from the library into the hierarchy, over the first page. It will insert the fragment into Variables. You can then right-click on the fragment and convert it to an embedded object.

Parallels Desktop2.png

Parallels Desktop2.png

It should work then,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi Joe,

Paul's example also contains a script object (look in the hierarchy for myScriptObject under Variables). This script object contains the LockAllFields function that is called from the click event of the button. The function does all of the work.

Parallels Desktop1.png

You can drag this script object to your fragment library, which will then make it available to you in other forms. In your form you would drag it from the library into the hierarchy, over the first page. It will insert the fragment into Variables. You can then right-click on the fragment and convert it to an embedded object.

Parallels Desktop2.png

Parallels Desktop2.png

It should work then,

Niall

Avatar

Former Community Member

Niall,

That did it.  Thank you.  I knew there was more too it then just pasting the script in the click event.  I just wasn't sure where too put the myscriptobject function that I saw in Paul's variables.  Now I have a little better understanding of what the fragment library is for.  Thanks again.