## Help with simple conditional form

Community Beginner ,
Aug 06, 2018

Copied

Hi,

I just need to create a calculation in which, in column A (Número de tarjetas a almacenar) you have a list of options to be selected. Depending on the option you select, the price is shown on column B.

Just with this, I would be really happy :-).

An aditional question is if I can determine as an exeption that if you select the last option "Más de 10000", then the price "Coste mensual" is calculated with a formula which is a number from another box* 3

Many thanks!

Most Valuable Participant
| Most Valuable Participant

OK. As the custom calculation script of the text field you can enter something like this:

`var v = this.getField("Número de tarjetas a almacenar").valueAsString;if (v=="0 - 300") event.value = "8€";else if (v=="300 - 600") event.value = "11€";else if (v=="600 - 1000") event.value = "15€";// etc.`
TOPICS
Acrobat SDK and JavaScript

Views

150

Likes

Report

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

## Help with simple conditional form

Community Beginner ,
Aug 06, 2018

Copied

Hi,

I just need to create a calculation in which, in column A (Número de tarjetas a almacenar) you have a list of options to be selected. Depending on the option you select, the price is shown on column B.

Just with this, I would be really happy :-).

An aditional question is if I can determine as an exeption that if you select the last option "Más de 10000", then the price "Coste mensual" is calculated with a formula which is a number from another box* 3

Many thanks!

Most Valuable Participant
| Most Valuable Participant

OK. As the custom calculation script of the text field you can enter something like this:

`var v = this.getField("Número de tarjetas a almacenar").valueAsString;if (v=="0 - 300") event.value = "8€";else if (v=="300 - 600") event.value = "11€";else if (v=="600 - 1000") event.value = "15€";// etc.`
TOPICS
Acrobat SDK and JavaScript

Views

151

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 06, 2018 0
11 Replies 11
Most Valuable Participant ,
Aug 06, 2018

Copied

You need to provide the full details of which value should appear in the text field for each of the values selected in the drop-down.

Likes

Report

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

Copied

0 - 300                   8€

300 - 600               11€

600 - 1000               15€

1000 - 3000               35€

3000 - 5000               60€

5000 - 10000               100€

Thanks!

Likes

Report

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

Copied

OK. As the custom calculation script of the text field you can enter something like this:

`var v = this.getField("Número de tarjetas a almacenar").valueAsString;if (v=="0 - 300") event.value = "8€";else if (v=="300 - 600") event.value = "11€";else if (v=="600 - 1000") event.value = "15€";// etc.`

Likes

Report

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

Copied

Thank! It works!

Likes

Report

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

Copied

One last thing. How can I say if a value from column A is greater than 10000 then multiply by 0,03?

Thanks!!

Likes

Report

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

Copied

Multiply what, exactly?

Likes

Report

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

Copied

So basically if I write a number higher than 10000 on column A multiply it by 0,03 on column B. Otherwise write "Not valid" on column B

Likes

Report

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

Copied

Is "Column A" the drop-down field? If not, what is the name of that field, and that of Column B?

Likes

Report

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

Copied

No drop down as I had to separate 1 range.

Column A field is called "ServiciosPlus-Tarjetasincluidas10000"

Column B is the calculation destination, called "ServiciosPlus-Coste10000"

Whatever value I put in column A needs to be multiplied by 0,03 except if it is under 10000 (if that´s the case a "Not valid" message should be shown

thanks!!

Likes

Report

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

Copied

OK, then use this code as the custom calculation script of the second field:

var v = Number(this.getField("ServiciosPlus-Tarjetasincluidas10000").valueAsString);

if (v<10000) event.value = "Not valid";

else event.value = v * 0.03;

Likes

Report

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

Copied

Thanks again!

Likes

Report

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