Skip to main content
Known Participant
August 23, 2024
Answered

If checkbox is selected, text appears elsewhere on document in text box

  • August 23, 2024
  • 2 replies
  • 9123 views

Hello! I am very new to using javascript especially in Acrobat pro. I would like when a checkbox is selected, specific text appears in another text box. And if unselected, the text will disappear.

 

What is the simplest way to write that code?

Thank you so much for your help!

    This topic has been closed for replies.
    Correct answer Nesa Nurani

    Let's say your 'text box' is actually a text field and let's say it's named "Text1", use this as Mouse UP action  'Run a JavaScript':

    var cText = "Put your text here";

    this.getField("Text1").value = (event.target.value == "Off")? "" : cText;

    2 replies

    Nesa Nurani
    Community Expert
    Nesa NuraniCommunity ExpertCorrect answer
    Community Expert
    August 24, 2024

    Let's say your 'text box' is actually a text field and let's say it's named "Text1", use this as Mouse UP action  'Run a JavaScript':

    var cText = "Put your text here";

    this.getField("Text1").value = (event.target.value == "Off")? "" : cText;

    Known Participant
    August 24, 2024

    OMG Nesa, Thank you so much!! It worked. I am so thankful to you. 😊

    kglad
    Community Expert
    Community Expert
    August 23, 2024

    sin the future, to find the best place to post your message, use the list here, https://community.adobe.com/

    p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



    <"moved from using the community">
    Known Participant
    August 24, 2024

    Thank you so much for your assistance. I have never posted on a community board before and you helped get my question seen.