Copy link to clipboard
Copied
I understand how to show and hide fields with a button click. But, what I'm trying to do is, click a button and to show a field only if that field has a calculation from other fields. If no info is calculated from the other fields, then the field in question would remain hidden no matter how many times I click the button. But then, the fields that have been populated would show leaving the un-populated fields hidden. Can this be done? Here's a couple of scripts I've been playing around with but I can't get to where I want to go using them.
Script:
this.getField("Item.1").display = display.hidden;
and/or,
if (this.getField("Item.1").valueAsString=="") event.target.display = display.hidden;
else event.target.display = display.visible;
Would someone teach me the correct script to do this and to help me out? Thanks.
Not really... Why would you need to hide a field that is empty? But never mind. You can do it like this:
var f = this.getField("Item.1");
f.display = (f.valueAsString=="") ? display.hidden : display.visible;
Copy link to clipboard
Copied
So you want to hide a field if it has no value, basically?
Copy link to clipboard
Copied
Hello, the fields I'm referring to sometimes have a sum, sometimes they don't. When they do I'd like to show them, but when they don't have anything in them they remain hidden. Only the fields which have a sum will show when I click the button. Is it possible? Know what I mean.
Copy link to clipboard
Copied
Not really... Why would you need to hide a field that is empty? But never mind. You can do it like this:
var f = this.getField("Item.1");
f.display = (f.valueAsString=="") ? display.hidden : display.visible;
Copy link to clipboard
Copied
Worked perfectly. Thank you. The reason I want to hide a field which is empty, well it's a little difficult to explain, but I have a table with a column with these fields. I have another field (a drop down) with percentage markups, i.e. 0%, 10%, 20%, etc. Some times the fields do a calculation. When that happens I have a button to show the column of fields. I don't want to show all the fields that calculate the percentage markup if they are empty, only the ones that have been populated are then visible. It makes for a neater form. Anyway, it now works the way I was hoping.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now