• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is is possible to replace the text in a texfield?

Participant ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

Hi everyone!

 

I´m trying to find a command that allows me to replace the original text  in a textfield, maybe

thru a button. The change in the text may be triggered by a user´s input in another textfield

or a button click.

Thanks a lot for your great help, in advance!!

TOPICS
Create PDFs , JavaScript , PDF forms

Views

336

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

Sure, that's possible. The basic command to do it is this:

this.getField("FieldName").value = "New field value";

If you want to copy the value of another field into it you can do it like this:

this.getField("FieldName").value = this.getField("OtherFieldName").value

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

Thank you very much!!

I suppose the second option could also be used to replace images, but my concern is if I have to store the images to be replaced somewhere or just hide the new image field and use (display.visible) to make it appear.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

Not quite, no. Images are not saved as the value of a regular field. They are saved as the icon of a button field, but copying them requires a different set of commands.

Here's how you would copy an image from Button2 to Button1:

 

this.getField("Button1").buttonSetIcon(this.getField("Button2").buttonGetIcon());

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 06, 2021 Apr 06, 2021

Copy link to clipboard

Copied

LATEST

Thank you! I´m going to try this script.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines