Hello everyone, I'm trying to create a group of fields that would have pre-populated text in the export value. Then combine those fields into one, which would make a complete sentence (or paragraph) of those field values. For example, Field1 would have "We propose to install". Then in Field2 would have the (total footage) "of 8' high CLF". In Field3 would have the total footage then "8' high WIF". In Field3 would have pretty much the same but this would be "of 8' high Wood Fence". Giving me the choice to show/hide the particular fields.
Yes, this is easily done. You can use something like this as the custom calculation script of the final field:
event.value = this.getField("Field1").valueAsString + this.getField("Field2").valueAsString + this.getField("Field3").valueAsString;
Heya Gilad, thanks for the quick response. The script works, but only when I type some text into the field. What I would like to do is not have to type and have the text filled in the default value of each text field and have that text fill into the end text field. I'll probably hide the fields and only show them when needed. Can that be done?
I don't understand what you mean... You want to combine the default values, not the actual values?
Yes. Is that possible? The Text Field Properties window. Options > Default Value. I have just typed in some text there and it doesn't change.
Sure. In the code, change all instances of "valueAsString" to "defaultValue".
Right on the money. Thanks, Gilad. That was perfect. Now for part 2. I would like the default values to populate into the destination text field only if one or all 3 text fields are visible.
You can use something like this, then:
var f1 = this.getField("Field1");
var f2 = this.getField("Field2");
var f3 = this.getField("Field3");
if (f1.display==display.visible || f2.display==display.visible || f3.display==display.visible)
event.value = f1.defaultValue + f2.defaultValue + f3.defaultValue;
else event.value = "";
Interesting. I'll have to play around with it later. You definitely know your stuff. Thanks for all your time.