Skip to main content
Inspiring
Jun 4, 2025 4:13 PM UTC
Question

Locking/ Unlocking Field (based on radio buttons) when Signature Field is Hidden/ Visible

The following code is in a calculation field.  I have a separate button that hides/ unhides the FC signature field.

 

The first part works when the FC signature field is hidden but the second part when the FC signature field is visible doesn't work for some reason and I cannot figure out why.

 

Goal is to lock the BO signature field if the CH signature field is signed (and FC signature field is unsigned) and the FC signature field is visible.  In other words, if we unhide the FC signature field after the CH signature field is signed (and FC signature field is unsigned), lock the BO signature field.

 

 

    if(getField("FC Signature").display = display.hidden)
        //when FC sig is hidden, locks BO sig when CH sig is empty/ unlocks BO sig when CH sig is signed
            if(getField("CH Signature").value == "") 
                getField("BO Signature").readonly = true

            else 
                getField("BO Signature").readonly = false

    else
        //when FC sig is visible, locks BO sig when CH sig is signed and FC sig is empty
            if(getField("CH Signature").value != "" && getField("FC Signature").value == "") 
                getField("BO Signature").readonly = true

 

15 replies

try67
Community Expert
Community Expert
Jun 4, 2025 8:23 PM UTC

When you want to compare two values use "==", or "===" (without the quotes). The "=" operator is used to assign a value.

Translate
MBChelsAuthor
Inspiring
Jun 4, 2025 8:43 PM UTC

Yes sir.  I tried that but the opposite happens.  When FC sig is visible,  it unlocks BO sig when CH sig is signed.  And when FC sig is hidden,  it locks BO sig when CH sig is signed.

Translate
try67
Community Expert
Community Expert
Jun 4, 2025 9:36 PM UTC

Where did you place the code?

Either way, you have to change it, as your current code is not correct.

Translate