Lock/ Unlock Checkboxes Based on Signature Fields (signed/ unsigned)
I have two signature fields: "CH Signature" and "BO Signature".
I have five other fields: "889 Check Box" , "Type Selection", "Date1_af_date", "Source Selection", "Items Check Box",
Starting point is:
- "CH Signature" unsigned and unlocked
- "889 Check Box" unlocked
- "BO Signature" unsigned and locked
- "Type Selection" unlocked
- "Date1_af_date" unlocked
- "Source Selection" unlocked
- "Items Check Box" unlocked
1. When "CH Signature" is signed, two things should happen:
a. Lock "889 Check Box"
b. Unlock "BO Signature"
Therefore, "CH Signature" runs the following code when signed:
this.getField("889 Check Box").readonly = true
this.getField("BO Signature").readonly = false
"CH Signature" has a Mouse Exit trigger set to always ensure that opposite happens when signature is cleared
if(getField("CH Signature").value == "")//CH sig not present
{
getField("889 Check Box").readonly = false
getField("BO Signature").readonly = true
}
2. Now that the "BO Signature" is unlocked, when it is signed, four things should happen:
a. Lock these four fields: "Type Selection", "Date1_af_date", "Source Selection", "Items Check Box"
Therefore, "BO Signature" runs the following code when signed:
this.getField("Date1_af_date").readonly = true
this.getField("Type Selection").readonly = true
this.getField("Items Check Box").readonly = true
this.getField("Source Selection").readonly = true
I have a Mouse Exit trigger set to always ensure that opposite happens when the signature is cleared and to ensure that the "BO Signature" field is always locked when "CH Signature" is not signed and vis versa.
if(getField("BO Signature").value == "")//BO sig not present
{
getField("Type Selection").readonly = false
getField("Date1_af_date").readonly = false
getField("Source Selection").readonly = false
getField("Items Check Box").readonly = false
}
//this ensures that "BO Signature" field is always locked when "CH Signature" is not signed and vis versa
if(getField("CH Signature").value != "")//CH sig is present
getField("BO Signature").readonly = false
else
getField("BO Signature").readonly = true
If I follow the sequence below, it will return everything back to starting point:
- Sign CH Signature
- Sign BO Signature
- Clear BO Signature
- Clear CH Signature
However, I have encountered a weird problem where if I clear 4) the CH Signature BEFORE 3) the BO Signature, the four fields ("Type Selection", "Date1_af_date", "Source Selection", "Items Check Box") will remain locked for some reason. Only way to unlock them is to sign the CH Signature which will unlock BO Signature to where I can hover the mouse in and out of BO Signature field to trigger the mouse exit to unlock those four fields.
Need help figuring out why this is happening because I should be able to get back to the starting point no matter which sequence.
