Expand my Community achievements bar.

Digi-sig reruns initializations (as does ordinary saves)

Avatar

Former Community Member

I want to set defaults on my form, such as graying-out and disabling coordinator blocks and have used form1.docReady under the Action Builder (i.e., "When form form1 has finished loading" do this and this and this).  Some coordinators on my form are unnecessary for routine issues, hence their blocks being disabled/grayed out; however, certain input choices require higher-level coordination and that enables and un-grays those coordinator blocks.

A user goes in, selects different things, enters various text, and the choices made change the defaults into whatever based on the user's selections.  However, upon digitally signing the form, a mandatory save routine runs in order to add the signature [part of the PDF run-time functionality to create digi-sigs].  That save routine then re-runs the form1.docReady routine in Action Builder--and the form resets everything back to the defaults instead of what the user chose.

Ouch!

Now, higher-level coordinators cannot do anything because those blocks have been disabled (again) by the form1.docReady routine.  [This is not a case of the digi-sig locking the form from further editing.  I set the individual digi-sigs to only lock their respective collections/objects and lower-level next-in-line coordinators can add their entries and digi-sign with no problems.]

Ergo, I have a problem.  I need something other than what Action Builder provides.  I need to set defaults the FIRST TIME a user opens the form and ONLY the first time.  A user may save the form prior to digitally signing it (lots of text to enter, lunch break, etc.)--and that save re-runs the form1.docReady routine and re-disables those higher-level coordinators.  [Thus, this isn't necessarily a digi-sig only issue.]

For each object, there is an "initialize", "docReady", "form:ready", and "layout:ready" scripting area to enter JavaScript.  "docReady" obviously isn't the event to do what I need the form to do since saving re-runs the form1.docReady routine in order to get the form ready for more input.  Does "initialize" run only once or every time the form gets opened?

Suggestions are greatly appreciated.

What I use: Adobe LiveCycle Designer ES4

1 Reply

Avatar

Level 7

Hi,

I have done something similar where i wanted something to run once and not run again. I was creating a form with a password. When the user opens the form for the first time, they are asked to create password, the next time they just enter the password they created. After they enter a password, an item is changed. The item is also referenced in the initialisation event and code won't trigger depending on the item. You could do it with a variable but i just used a simple TextField.

I have a hidden TextField (initialPass) with the default value 1.

form1: initialise event

if(initialPass.rawValue == "1")
{
  this.resolveNode("tblCreatePassword").presence = "visible"; //show the Create Password table
}

if(initialPass.rawValue == "0")
{
  this.resolveNode("tblCreatePassword").presence = "hidden"; //hide the Create Password table
  this.resolveNode("tblEnterPassword").presence = "visible"; //show the Enter Password table
}

In the tblCreatePassword table (consists of a TextField and a Button), the button has this code

Button1: click

initialPass.rawValue = "0"; //set initialPass to 0 so next time you do not create a password

tblCreatePassword.presence = "hidden"; //hide the create password table

If you are able to follow this:

When the form initialises, if the initialPass TextField is 1 (which it is by default on the first run), show the tblCreatePassword table. After a new password is entered in the tblCreatePassword TextField and the button is clicked. Change the initialPass TextField to 0 and hide the tblCreatePassword table.

When you save the form, the initialPass TextField (which is now 0) is saved, so next time the form is initialised, the initialPass TextField is 0 and tblCreatePassword is hidden but tblEnterPassword is shown.

Might not be a highly technical solution, but it works.