Skip to main content
Known Participant
June 30, 2021
Answered

I am trying to hide the digital signature until every field and checkbox is completed.

  • June 30, 2021
  • 3 replies
  • 1058 views

var bEmpty = false;

var oFld = this.getField("Date") bEmpty |= /^\s*$/.test(oFld.value);

var oFld = this.getField("Vessel Name") bEmpty |= /^\s*$/.test(oFld.value);

var oFld = this.getField("Group0") bEmpty |= /^\s*$/.test(oFld.value);

var oFld = this.getField("Check Box 2") bEmpty |= /^\s*$/.test(oFld.value);

var oFld = this.getField("Check Box 3") bEmpty |= /^\s*$/.test(oFld.value);

this.getField("Employee Name").display = bEmpty ? display.hidden : display.visible;

This topic has been closed for replies.
Correct answer Nesa Nurani

Try this in any text field as custom calculation script:

var bEmpty = "";
if(this.getField("Date").valueAsString == "" || this.getField("Vessel Name").valueAsString == "" || this.getField("Group0").valueAsString == "Off" || this.getField("Check Box 2").valueAsString == "Off" || this.getField("Check Box 3").valueAsString == "Off")
var bEmpty = "true";
this.getField("Employee Name").display = bEmpty == "true" ? display.hidden : display.visible;

 

3 replies

Lori5ED9Author
Known Participant
June 30, 2021

I just noticed that Group0 isn't being recognized as not checked. There are 2 checkboxes in this group for "Yes" and "No". Do you know how I fix it? When I check the other boxes and fields but don't answer yes or no in Group0, the signature unhides.

try67
Community Expert
Community Expert
June 30, 2021

When no widget is selected in a radio-button group the field's value is not an empty string, but "Off".

Bernd Alheit
Community Expert
Community Expert
June 30, 2021

What happens when you use the script? Where does you use the script?

Lori5ED9Author
Known Participant
June 30, 2021

The script works for the dropdown fields (date & vessel name). If those aren't completed the "Click Here To Sign" button doesn't allow the digital signature to unhide. However, if the checkboxes are not checked, it will still unhide assuming the dropdown and text fields are completed.

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
June 30, 2021

Try this in any text field as custom calculation script:

var bEmpty = "";
if(this.getField("Date").valueAsString == "" || this.getField("Vessel Name").valueAsString == "" || this.getField("Group0").valueAsString == "Off" || this.getField("Check Box 2").valueAsString == "Off" || this.getField("Check Box 3").valueAsString == "Off")
var bEmpty = "true";
this.getField("Employee Name").display = bEmpty == "true" ? display.hidden : display.visible;

 

Lori5ED9Author
Known Participant
June 30, 2021

This worked! Thank you so very much!!!