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

Multiple Conditions Based on a numerical value and a name.

Community Beginner ,
Oct 01, 2018 Oct 01, 2018

Hi,

I have a few issues regarding a multiple condition statement.  I am trying to add If && to the below code additions in bold

if (this.getField("Radio Button 1").value == "1")  && if (this.getField("Bespoke Button").value == "Yes")

event.value ="Matthew" ;

else

if (this.getField("Radio Button 1").value == "2") && if (this.getField("Dropdown4").value == "Yes")

event.value ="Andy Stammers"; 

else...

Few similar lines so won't post all code.

I cannot get the multiple conditions to work. Can somebody help?

Thanks,

George

TOPICS
PDF forms
519
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 01, 2018 Oct 01, 2018

Basically, you need to change this line:

if (this.getField("Radio Button 1").value == "1")  && if (this.getField("Bespoke Button").value == "Yes")

To this:

if (this.getField("Radio Button 1").valueAsString == "1" && this.getField("Bespoke Button").valueAsString == "Yes")

And repeat for the rest of your if-conditions.

View solution in original post

Translate
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 ,
Oct 01, 2018 Oct 01, 2018

You have errors in your code. Check the JS Console and they should appear there as soon as you enter it.

Translate
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 ,
Oct 01, 2018 Oct 01, 2018

Basically, you need to change this line:

if (this.getField("Radio Button 1").value == "1")  && if (this.getField("Bespoke Button").value == "Yes")

To this:

if (this.getField("Radio Button 1").valueAsString == "1" && this.getField("Bespoke Button").valueAsString == "Yes")

And repeat for the rest of your if-conditions.

Translate
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 ,
Oct 01, 2018 Oct 01, 2018
LATEST

Sorry try67, I'm a complete novice. the editor isn't very explanatory as to where the errors are within the code.

Thanks for your help. Worked Great.

Translate
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