Radio Button selection pulling data from one field to another?

Community Beginner ,
Dec 19, 2018

Copy link to clipboard

Copied

Hi there,

Big thanks to everyone, I already received great help on this forum from technical wizards!

User inputs manually into RentPW (rent per week) i.e, 500, 550, 1000 etc

There is a radio button PaymentType with TWO either-or choices:

Full - Pay everything up front in full

Part - Pay monthly

If the user selects Choice 1, I need the SecureDep field to be populate with: RentPW * 2

If the user selects Choice 2 - I need the SecureDep field to be populated with: RentPW * 6

Is this possible?

Just in case, I have attached the actual form: Dropbox - Test Booking Form.pdf

TOPICS
Acrobat SDK and JavaScript

Views

85

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Radio Button selection pulling data from one field to another?

Community Beginner ,
Dec 19, 2018

Copy link to clipboard

Copied

Hi there,

Big thanks to everyone, I already received great help on this forum from technical wizards!

User inputs manually into RentPW (rent per week) i.e, 500, 550, 1000 etc

There is a radio button PaymentType with TWO either-or choices:

Full - Pay everything up front in full

Part - Pay monthly

If the user selects Choice 1, I need the SecureDep field to be populate with: RentPW * 2

If the user selects Choice 2 - I need the SecureDep field to be populated with: RentPW * 6

Is this possible?

Just in case, I have attached the actual form: Dropbox - Test Booking Form.pdf

TOPICS
Acrobat SDK and JavaScript

Views

86

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 19, 2018 0
Community Beginner ,
Dec 19, 2018

Copy link to clipboard

Copied

I have tried the following but it didn't work 😕

var a = this.getField("PaymentType").valueAsString; 
var b = this.getField("Part").valueAsString; 
var c = this.getField("Full").valueAsString;
var RentPW = +getField("RentPW").value;

if (a=="Part") event.value = RentPW * 6; 
else if (a=="Full") event.value = RentPw * 2; 
else event.value = ""; 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 0
Most Valuable Participant ,
Dec 19, 2018

Copy link to clipboard

Copied

Are there fields called "Part" and "Full"? If so, what do they have to do with this calculation?

And yes, it's certainly possible to do it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 0
Community Beginner ,
Dec 19, 2018

Copy link to clipboard

Copied

There aren't any fields, Full and Part are just the options or choices that are given to the user.

The radio button group is called PaymentType and the first box checked is called Full and the second box is called Part.

Hope I'm explaining it clearly. I don't understand why my script doesn't work?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 0
Most Valuable Participant ,
Dec 19, 2018

Copy link to clipboard

Copied

Because you're trying to access non-existing fields... Remove those two lines and it should work.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 0
Community Beginner ,
Dec 19, 2018

Copy link to clipboard

Copied

Thanks Try,

I used this and it works:

var SecureDep = +getField("SecureDep").value;

    var RentPW = +getField("RentPW").value;

    var RentPCM = +getField("RentPCM").value;

    var ContractLength = +getField("ContractLength").value;

var PaymentType = this.getField("PaymentType").value;

if (PaymentType=="Full") {

    event.value =  2 * RentPW;

} else event.value = 6 * RentPW;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 0
try67 LATEST
Most Valuable Participant ,
Dec 19, 2018

Copy link to clipboard

Copied

Why do you continue to define variables that are not used in the actual code later on?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 1