Skip to main content
Inspiring
October 17, 2019
Answered

Populate checkbox with button click - need help with script

  • October 17, 2019
  • 1 reply
  • 2538 views

I found the following JavaScript on JSFiddle for what I need to do, but I don’t know how to apply it to my PDF document to make it work.  Could one of you super amazing brilliant genius javaScript experts help me with this?

 

$(function() {

  $("button").on("click",function() {

    $("input[value='mercedes']").prop("checked",true);

  });

});

 

I would like to be able to populate a checkbox when the Click Me button is clicked.  I need the user to be able to click on the button to add more attachments without making the button disappear, and the user will need to be able to manually uncheck the box.

 

 

    This topic has been closed for replies.
    Correct answer Bernd Alheit
    var btn = this.getField("Button1").value; if (btn == "Button1") { this.getField("Check Box2").value = "Yes"; } else {
    On mouse click you can use: this.getField("Check Box2").value = "Yes";

    1 reply

    Bernd Alheit
    Community Expert
    Community Expert
    October 17, 2019

    This is code for web browsers.

    Inspiring
    October 17, 2019
    Oh, that's the closest thing I could find for what I need. Would you happen to have a resource that could help me figure out how I could do this? It's important I figure out and I'm totally lost with how to do this. The only other thing I could find was a script for a radio button, but I need it for an Add Button https://answers.acrobatusers.com/Is-it-possible-to-use-javascript-to-have-a-check-box-checked-if-a-radio-button-is-checked-q198799.aspx
    Inspiring
    October 17, 2019
    I tried adding the following custom calculation script in a hidden text field, but it didn't work