Dec 18, 2015, 1:01 PM
2 Posts

Hide label if field is blank

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 2

Hello,

I have a seemingly simple issue that I can't seem to get correct.  I have an application that contains record that will only be read and never edited.  If a field value on the backend record is blank, I want to hide the corresponding label.  I have searched many different topics and forums, but still don't have an example of working code.  Any help would be appreciated.

I tried this code on the computed value of the Visible property to no avail:

var A1 = currentDocument.getItemValueString("AI1");

if (A1 ==null){

false;

}

else{

true;

)

 

Thank you for your help.

Dec 18, 2015, 2:17 PM
2 Posts
Resolved

Here is the correct code that I used to hide the label if the field value is blank:

var A1 = currentDocument.getItemValueString("AI1");

if(A1 == "X"){

true;

}

else{

false;

}

Feb 16, 2016, 5:59 PM
1 Posts
Another solution

Since anything "real" in javascript is true and false otherwise you could also just use something like this:


return currentDocument.getItemValueString("Al1");