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

I need to click on a number to populate text in a text box in a different spot on my document.

Community Beginner ,
Feb 02, 2024 Feb 02, 2024

I need to be able to click on one of these numbers; each number will populate a different text into the text box below. I have read many of the Q & A's here are some are close to what I need, but do not work for my specific issue. 

Any help will be greatly appreciated! 

Anne35206694eyto_2-1706888570400.png

Anne35206694eyto_0-1706888314781.png

 

TOPICS
Windows
729
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 ,
Feb 02, 2024 Feb 02, 2024

What you mean to ask is,  "I want to populate a text box from a selection in a dropdown field".  

 

Add this code to the custom Validation script for the dropdown.

 

this.getField("Text11").value = event.value;

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Feb 05, 2024 Feb 05, 2024

Thank-you for your answer, it did work. 🙂 

However, here is a snippit of a simpler example of what I am trying to do: 

I want to make a checkbox like this - 

Anne35206694eyto_2-1707144296202.png

That will populate text and the check on a seperate page to look like this: 

Anne35206694eyto_1-1707144245887.png

So one checkmark needs to populate a checkmark and text. 

Does this make sense? 

 

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 ,
Feb 05, 2024 Feb 05, 2024

You can read about the basics of programming checkboxes and radio buttons here:

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

With a checkbox, use the MouseUp action.

 

if(event.target.value != "Off")

{// Set text and check

    this.getField("TextBox").value = "some text";

    this.getField("OtherCheck").value = "Yes";

}

else

{// Clear Text and check

    this.getField("TextBox").value = "";

    this.getField("OtherCheck").value = "No";

}

 

Be aware that to set a checkbox, the checkbox value must be set to it's Export Value.

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Feb 05, 2024 Feb 05, 2024

Hi Tom, 

Thank-you so much for your help! I am using Adobe Pro as a part of my comanies contract with Adobe and do not have my own sign on information to access the link that you sent. I have also tried the script above and am not able to make it work; I end up with a checkmark in the box where it is suppose to be, which is good, but I also end up with a checkmark in the spot where I need for my text to go. I am brand new at this and know nothing about scipt or coding, I only need to get through this one project. My appoligies for my lack of abilities! 

 

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 Beginner ,
Feb 05, 2024 Feb 05, 2024

I got it to work!!! Yayyy!!! Thank-you sooooo much! 

I may have more questions through out this project. 🙂 

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 Beginner ,
Feb 05, 2024 Feb 05, 2024

Another question....

I have this java script modified from what you gave me earlier and it works beautifully for adding the text to one line, However, I need to add this same text to the next 2 lines as well.... please help 🙂 

 

if(event.target.value != "Off")
{// Set text and check
this.getField("Bap 1").value = "See Single Limit"; this.getField("See Single Limit").value = "See Single Limit";
}
else
{// Clear Text and check
this.getField("See Single Limit").value = "";
this.getField("See Single Limit").value = "No";
}

 

Anne35206694eyto_0-1707166874542.png

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 ,
Feb 05, 2024 Feb 05, 2024

Looks like you have the right idea. Repeat the same line that sets the text, but change the field name. 

Besides the bad formatting (put separate statements on separate lines), it looks like you need to get the correct field names.   Open the "Prepare Form" tools and the field names will be displayed. 

 

These tutorials might help:

https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm 

https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm

https://www.pdfscripting.com/public/FreeStuff/AcroForm_Create/AcroForms_Part2g_WhyFieldNames_mp4.cfm

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Feb 06, 2024 Feb 06, 2024

Hi Tom, 

Thank-you for the info, I was able to populate all 3 lines beautifully! 

I am now working on adding text to a text box when multiple checkboxes are marked/selected. I have looked all through the links that you sent and tried several suggested options, but nothing is working for me. (this is why I do not make my living as a code specialist!) 

I need for these boxes in Red :

Anne35206694eyto_0-1707235882493.png

to add text to this box below all at the same time if selected; or only a few if selected. 

Anne35206694eyto_1-1707235987444.png

I will be doing this same thing from drop down boxes once I have this part with the checkmarks completed.

Thanks again 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 ,
Feb 06, 2024 Feb 06, 2024
LATEST

Since this is a different topic, please post it to a new thread. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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