• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Radio Button selection pulling data from one field to another?

Community Beginner ,
Dec 19, 2018 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

456

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
community guidelines
Community Beginner ,
Dec 19, 2018 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 = ""; 

Votes

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
community guidelines
Community Expert ,
Dec 19, 2018 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.

Votes

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
community guidelines
Community Beginner ,
Dec 19, 2018 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?

Votes

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
community guidelines
Community Expert ,
Dec 19, 2018 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.

Votes

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
community guidelines
Community Beginner ,
Dec 19, 2018 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;

Votes

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
community guidelines
Community Expert ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines