Skip to main content
Inspiring
June 4, 2025
Question

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

  • June 4, 2025
  • 1 reply
  • 1258 views

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

 

1 reply

try67
Community Expert
Community Expert
June 4, 2025

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

MBChelsAuthor
Inspiring
June 4, 2025

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.

try67
Community Expert
Community Expert
June 4, 2025

Where did you place the code?

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