user1426583
user1426583

Reputation: 319

Radio Button Value in pdf (javascript calculation)

I have a form which I am creating in Adobe Pro.

The "Grandtotal" field is determined by a variety of radio buttons selected.

My first step is to give each of the radio buttons a value.

My set of radio buttons is called "Options" - Radio button 1: "15" Radio button 2: "25"

What javascript could I use to put the value of the selected radio button (either 15 or 25) into my "Grandtotal" field ?

I have tried the following:

var option1 = this.getField("Options");
var option2 = this.getField("Options");

var total = this.getField("Grandtotal").value;
event.value = option1 or option2

Thank you

Upvotes: 0

Views: 15585

Answers (1)

Ian
Ian

Reputation: 50905

I don't know the use of Javascript in PDFs, but what I found online, it looks like you should use something like this:

var option1 = this.getField("Options1");  // Get first radio button
var option2 = this.getField("Options2");  // Get second radio button
var total = this.getField("Grandtotal");  // Get grand total textbox

if (option1.checked) {
    total.value = option1.value;
} else if (option2.checked) {
    total.value = option2.value;
}

Now, I'm not sure what you mean by my set of radio buttons is called "Options", because that would mean retrieving the radio button fields might be different.

Upvotes: 1

Related Questions