Expand my Community achievements bar.

How to make presence visible or invisible of a textfield

Avatar

Former Community Member

I have a list of textfield, i use itextsharp (C#) to valorize them.
For example i valorize the textfield: "topmostSubform.Page1.codice_articolo_0" with:

if i valorize the textfield, i must make it visible, else if it has no value, i must make it invisible.

For every textfield i add this script:

But it doesn't work, i have all the textfield invisible!

How can i resolve?

3 Replies

Avatar

Level 7

this.rawValue == null might be evaluting "true" for everything. Can you disable the script for a few text fields and load the doc to see if the values are loading properly?

Avatar

Former Community Member

i tried the doc withouth the script and i have no problem, the values are loading properly

Avatar

Level 7

Are any of your fields invisible already? If not, can you remove the nested if statements?

if (this.isNull) this.presence = "invisible";

else this.presence = "visible"; //this line may not be necessary if they're starting visible

Logically, the original should work. On a small test form, I can't seem to make it fail. (To test, I created a small form with a field. added your code to the docReady event, and the field is visible if it has something assigned to it, invisible if it doesn't.)