Skip to main content
Inspiring
November 8, 2017
Question

Auto-fill a text field with a popup window when a radio button is selected.

  • November 8, 2017
  • 1 reply
  • 1163 views

I have a button labeled Military.  When a user clicks on that button, I have a window that pops up asking if they're Active Duty, National Guard, or Reservist.  I'm asking them to input a number representing one of the three choices and then another field auto-fills their choice when they click OK.  Otherwise the field is blank.  Here is what I have so far, but nothing is auto-filled into the other field:

var vMil = this.getField("13: Persona");

// Display Response Box
var vMilInfo = app.response("Input the number representing your military status.\n\n1) Active Duty\n2) National Guard\n3) Reservist"," [Box 9 - DESIGNATION OF PERSON]");

switch(vMilInfo){
case "1":
  vMil.value = "A = Active Duty";
  vValidResponse = 1;
  break;
case "2":
  vMil.value = "N = National Guard";
  vValidResponse = 1; 
  break;
case "3":
  vMil.value = "V = Reservist";
  vValidResponse = 1;
  break;
  vMil.value = "";
   }

I'm doing this in Adobe Acrobat PDF form.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 8, 2017

Why did you add the last line where you're setting the vMil field to an empty string?

Also, why are you changing the value of vValidResponse in each case?

SIPRNet11Author
Inspiring
November 9, 2017

I added the last line because I thought that I was saying there that if the button is not checked, then the other field would be blank.  As for the vValidResponse, I was testing something and just forgot to take those lines out before copying my code here.

try67
Community Expert
Community Expert
November 9, 2017

You should put that line before the switch command, or under the "default" case.