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!!
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
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.
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());
Copy link to clipboard
Copied
Thank you! I´m going to try this script.