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

Auto populate image signature/image field from dropdown list

New Here ,
Jan 13, 2025 Jan 13, 2025

Hi All, 

 

i've created a fillable PDF form. I have a drop down with a list of names and a field underneath it.

 

I'd like to be able to select any name from the dropdown and for the field underneath to auto populate with the signature of that person. I have all the signatures saved as images (mix of JPG and PNG files). Does the signature field need to be an image field, or text or other? I've tried googling the Java script to make this happen, but i can't quite get my head around it. Any help would be appreciated if you would know the script for this?

 

Thanks

TOPICS
JavaScript , PDF forms
853
Translate
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Jan 13, 2025 Jan 13, 2025

Create a button field for each signature and name them exactly the same as the their names in the dropdown.  Set the button layouts to "Icon only".  Import the .png and .jpg files into the buttons so they display the signatures.  Hide the button fields that contain the signatures.  Assuming your image field name is "Image1_af_image" enter the following custom validation script in the dropdown:

this.getField("Image1_af_image").buttonSetIcon(this.getField(event.value).buttonGetIcon())

View solution in original post

Translate
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 ,
Jan 13, 2025 Jan 13, 2025

You can prepopulate image fields and then show/hide them depending on dropdown choice.
Here is an example script that would go into dropdown validate script (of course change names and image field names to your actual names:

this.getField("Image1").display = (event.value == "John Doe") ? display.visible : display.hidden;
this.getField("Image2").display = (event.value == "Jane Doe") ? display.visible : display.hidden;

View solution in original post

Translate
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 ,
Jan 13, 2025 Jan 13, 2025

Create a button field for each signature and name them exactly the same as the their names in the dropdown.  Set the button layouts to "Icon only".  Import the .png and .jpg files into the buttons so they display the signatures.  Hide the button fields that contain the signatures.  Assuming your image field name is "Image1_af_image" enter the following custom validation script in the dropdown:

this.getField("Image1_af_image").buttonSetIcon(this.getField(event.value).buttonGetIcon())
Translate
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
New Here ,
Jan 14, 2025 Jan 14, 2025

thanks for your reply, i've tried this but still can't get it to work, anything i might be missing? I've set the button field to hidden and done what you've said, but can't get it to show when i select the name from the dropdown.

Translate
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
New Here ,
Jan 14, 2025 Jan 14, 2025

oh it does work! But i have to click away frrom the drop down for the signature to show

Translate
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 ,
Jan 14, 2025 Jan 14, 2025

In the options tab of the dropdown, select "Commit selected value immediatley" and the signature should appear instantly.

Translate
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
New Here ,
Jan 14, 2025 Jan 14, 2025
LATEST

Amazing! Thank you so much.

Translate
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 ,
Jan 13, 2025 Jan 13, 2025

You can prepopulate image fields and then show/hide them depending on dropdown choice.
Here is an example script that would go into dropdown validate script (of course change names and image field names to your actual names:

this.getField("Image1").display = (event.value == "John Doe") ? display.visible : display.hidden;
this.getField("Image2").display = (event.value == "Jane Doe") ? display.visible : display.hidden;
Translate
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
New Here ,
Jan 14, 2025 Jan 14, 2025

this also works thankyou

Translate
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