Expand my Community achievements bar.

SOLVED

password does not work

Avatar

Level 6

Hello,

In my form, I have buttons which only I can operate by entering a password.  The problem is that even though I have the password in the script, you can enter any word or letter or number into the password block and the button still operates.  I think it's because I'm using JavaScript and Formcalc on the buttons, but not sure.  Can you help? Below are the scripts of three buttons.  The first two are the ones that do not work the way I want them to.  The third one works fine.

 

The "lock fields button" is supposed to work like this:  Press button, it asks for a password.  If correct, it will lock the fields and also make the button hidden.  Problem:  When I enter an incorrect password, it still locks and the button is hidden.  I want it to not lock or do anything if the password is entered incorrectly.

The "unlock fields button" is supposed to work like this:  Press button, it asks for a password.  If correct, it will unlock the fields and the "lock fields button" would reappear.  Problem: When I enter an incorrect password, it still unlocks the fields and the button reappears.  I want it to not unlock or do anything if the password is entered incorrectly.

 

LOCK FIELDS button

form1.#subform[0].SIGNATURE.lockfields::click - (JavaScript, client)
//+ GENERATED - DO NOT EDIT (ID:6D0428BF-ECD8-4723-BDBB-ED8AF8FA1B1C CRC:20307874)
//+ Type: Action
//+ Result1: SetPresence("$Node1","hidden")
//+ Node1: form1[0].#subform[0].SIGNATURE[0].lockfields[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: lockfields.click
this.resolveNode("$").presence = "hidden";
//-
oTargetField = this.resolveNode("HEADERS");
oTargetField.access = "readOnly";
oTargetField = this.resolveNode("form1.#subform[2]");
oTargetField.access = "readOnly";
oTargetField = this.resolveNode("form1.#subform[2].DISPOSITIONLIST");
oTargetField.access = "readOnly";
//-
if (xfa.host.response("Password:", "Admin Password") == "PASSWORD") then

SIGNATURE.lockfields.presence = "readOnly"

endif

 

unlock fields button

 

form1.#subform[0].SIGNATURE.unlockfelds::click - (JavaScript, client)
//+ GENERATED - DO NOT EDIT (ID:6EFF37E6-D5ED-4414-B3C3-10B478C8F1DC CRC:2465940404)
//+ Type: Action
//+ Result1: SetPresence("$Node2","visible")
//+ Node2: form1[0].#subform[0].SIGNATURE[0].lockfields[0]
//+ Node1: form1[0].#subform[0].SIGNATURE[0].unlockfelds[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: unlockfelds.click
this.resolveNode("lockfields").presence = "visible";
//-
//+ GENERATED - DO NOT EDIT (ID:954E4C9A-7D93-4108-949E-6D5819C106D6 CRC:915740995)
//+ Type: Action
//+ Result3: SetEnabled("$Node4","open")
//+ Result2: SetEnabled("$Node3","open")
//+ Result1: SetEnabled("$Node2","open")
//+ Node4: form1[0].#subform[0].#subform[2].DISPOSITIONLIST[0]
//+ Node3: form1[0].#subform[0].#subform[2]
//+ Node2: form1[0].#subform[0].HEADERS[0]
//+ Node1: form1[0].#subform[0].SIGNATURE[0].unlockfelds[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: unlockfelds.click
oTargetField = this.resolveNode("HEADERS");
oTargetField.access = "open";
oTargetField = this.resolveNode("form1.#subform[2]");
oTargetField.access = "open";
oTargetField = this.resolveNode("form1.#subform[2].DISPOSITIONLIST");
oTargetField.access = "open";
//-
if (xfa.host.response("Password:", "Admin Password") == "PASSWORD") then

SIGNATURE.unlockfelds.presence = "visible"

endif

 

enter Disposition date button

 

form1.#subform[0].SIGNATURE.dispodatebutton::click - (FormCalc, client)
if (xfa.host.response("Password:", "Admin Password") == "PASSWORD") then

DISPOSITIONLIST.DISPODATE.presence = "visible"

endif

1 Accepted Solution

Avatar

Correct answer by
Employee

This seems to do what you describe:

kprokopi_0-1594146747787.pngkprokopi_1-1594146783515.pngkprokopi_2-1594146802470.pngkprokopi_3-1594146820948.pngkprokopi_4-1594146851001.png

 

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

This seems to do what you describe:

kprokopi_0-1594146747787.pngkprokopi_1-1594146783515.pngkprokopi_2-1594146802470.pngkprokopi_3-1594146820948.pngkprokopi_4-1594146851001.png