2 Replies Latest reply on Jul 18, 2016 9:14 AM by sheri spencerb48749646

Trying to do an if statement that has multiple choices

Here's what I have:

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

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

if( (LF<300) && (LANDSCAPING=="Light") )event.value = 525;

else if( (LF<300) && (LANDSCAPING=="Medium") )event.value = 535;

else if ( (LF<300) && (LANDSCAPING=="Heavy") )event.value=550;

else if ( (LF>=300) && (LF<350) && (LANDSCAPING==Light) )event.value=535;

else if ( (LF>=300) && (LF<350) && (LANDSCAPING==Medium) )event.value=545;

else if ( (LF>=300) && (LF<350) && (LANDSCAPING==Heavy) )event.value=560;

else if ( (LF>=350) && (LF<400) && (LANDSCAPING==Light) )event.value=545;

else if ( (LF>=350) && (LF<400) && (LANDSCAPING==Medium) )event.value=555;

else if ( (LF>=350) && (LF<400) && (LANDSCAPING==Heavy) )event.value=570;

else if( (LF>=400) && (LANDSCAPING==Light) )event.value = (LF*1.82);

else if( (LF>=400) && (LANDSCAPING==Medium) )event.value = (LF*1.85);

else if ( (LF>=400) && (LANDSCAPING==Heavy) )event.value=(LF*1.89);

This part works:

if( (LF<300) && (LANDSCAPING=="Light") )event.value = 525;

else if( (LF<300) && (LANDSCAPING=="Medium") )event.value = 535;

else if ( (LF<300) && (LANDSCAPING=="Heavy") )event.value=550;

The rest does not.

• 1. Re: Trying to do an if statement that has multiple choices

Because you stopped adding double-quotes around the strings at that point...

• 2. Re: Trying to do an if statement that has multiple choices

now i see that.  Thanks