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

simple expression not working

Community Beginner ,
Feb 15, 2023 Feb 15, 2023

Copy link to clipboard

Copied

I have 3 options for this field, either they choose "0", "5000", or "10000".  Based on that choice I need the next field to calculate the monthly rate *12 then divide by 52 to get their weekly rate.  Please help, what am I missing below?

 

var chrate=(this.getField("ChildVLife").valueAsString);
var morate=0
if(chrate=0) morate=0.0;
else if (chrate=5000) morate=1.00;
else if (chrate=10000) morate=2.00;
event.value=((morate*12)/52);

TOPICS
How to , JavaScript , PDF forms

Views

859

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

correct answers 1 Correct answer

Community Expert , Feb 15, 2023 Feb 15, 2023

To compare values use == not only =.

E.g.: chrate==5000

Votes

Translate

Translate
Community Expert ,
Feb 15, 2023 Feb 15, 2023

Copy link to clipboard

Copied

To compare values use == not only =.

E.g.: chrate==5000

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 ,
Feb 15, 2023 Feb 15, 2023

Copy link to clipboard

Copied

LATEST

Thank you, worked perfectly.

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