Skip to main content
Known Participant
July 26, 2019
Answered

Combining text fields into one to create a description

  • July 26, 2019
  • 1 reply
  • 1436 views

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.

Is this something that can be done using javascript? I don't know enough but I'd like to learn. Or, does anyone know of a way to accomplish something like this in a PDF. I'd like to create a short cut to be able to put the combinations into a job description. If you can show me how to create the first one, then I can do the rest. Thank you all so much.

This topic has been closed for replies.
Correct answer try67

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".

1 reply

try67
Community Expert
Community Expert
July 26, 2019

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;

pdfUser1Author
Known Participant
July 26, 2019

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?

try67
Community Expert
Community Expert
July 26, 2019

I don't understand what you mean... You want to combine the default values, not the actual values?