Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter WillBigGun

    (@willbiggun)

    Ignore this I have managed with

    (function(){
    if(fieldname20 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname1 >= 331 && fieldname1 <= 4) return ‘Price on its way via email’;
    if(fieldname2 >= 901 && fieldname2 <= 4) return ‘Price on its way via email’;
    if(fieldname21 >= 545 && fieldname21 <= 2.4) return ‘Price on its way via email’;
    if(fieldname3 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname65 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname50 >= 5000 && fieldname50 <= 0) return ‘Price on its way via email’;
    else return
    NUMBERFORMAT(fieldname18+fieldname64+fieldname65+fieldname66, ‘GBP’);
    })();

    Thread Starter WillBigGun

    (@willbiggun)

    Sorry,

    It is still not working when I put 1 in fieldname 1

    what am I doing wrong?

    (function(){
    if(fieldname20 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname1 >= 331 || fieldname1 <= 4) return ‘Price on its way via email’;
    if(fieldname2 >= 901 || fieldname2 <= 4) return ‘Price on its way via email’;
    if(fieldname21 >= 545 || fieldname21 <= 2.4) return ‘Price on its way via email’;
    if(fieldname3 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname65 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname50 >= 5000 || fieldname50 <= 0) return ‘Price on its way via email’;
    else return
    NUMBERFORMATT(fieldname68/fieldname50, ‘GBP’);
    })();

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Perfect. However, if you’ve any doubt, feel free to ask me.

    Best regards.

    Thread Starter WillBigGun

    (@willbiggun)

    This is not working. I have put a value of 1 in the fieldname1 and it is not displaying the text ‘Price on its way via email’

    (function(){
    if(fieldname20 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname1 > 330 && fieldname1 < 5) return ‘Price on its way via email’;
    if(fieldname2 > 900 && fieldname2 < 5) return ‘Price on its way via email’;
    if(fieldname21 > 545 && fieldname21 < 2.5) return ‘Price on its way via email’;
    if(fieldname3 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname65 == ‘Custom:’) return ‘Price on its way via email’;
    if(fieldname50 > 5000 && fieldname50 < 1) return ‘Price on its way via email’;
    else return
    NUMBERFORMATT(fieldname68/fieldname50, ‘GBP’);
    })();

    What am I doing wrong?

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Could you send me the URL to your webpage to check the form in action, please?

    However there are multiple issues in your conditional statements. For example:

    – fieldname1 cannot be bigger than 330 and less than 5 at the same time.
    if(fieldname1 > 330 && fieldname1 < 5) return ‘Price on its way via email’;

    – fieldname2 cannot be bigger than 900 and less than 5 at the same time.
    if(fieldname2 > 900 && fieldname2 < 5) return ‘Price on its way via email’;

    – fieldname21 cannot be bigger than 545 and less than 2.5 at the same time.
    if(fieldname21 > 545 && fieldname21 < 2.5) return ‘Price on its way via email’;

    – fieldname50 cannot be bigger than 5000 and less than 1 at the same time.
    if(fieldname50 > 5000 && fieldname50 < 1) return ‘Price on its way via email’;

    Best regards.

    Thread Starter WillBigGun

    (@willbiggun)

    Hi How would I make it so if the figure is not within 5-330 then display the ‘Price on its way via email’ text?

    Plugin Author codepeople

    (@codepeople)

    Hi,

    You should use the “or” connector, in place of “and”. For example:

    if(fieldname50 > 5000 || fieldname50 < 1) return ‘Price on its way via email’;

    The previous conditional statement is true if the value of fieldname50 is bigger than 5000 or less than 1

    Best regards.

    Thread Starter WillBigGun

    (@willbiggun)

    Plugin Author codepeople

    (@codepeople)

    Hi,

    There are some serious problems with your form, I’ve checked only one conditional statement, but I guess the issue should be present too in the other conditional statements. In the conditional statement:

    if(fieldname1 > 330 || fieldname1 < 5) return ‘Price on its way via email’;

    The fieldname1 field represents the label’s height, that is a dependent field. If a dependent field is not active, its value is 0. So, if the label attributes are not defined, its height would be zero, and the previous condition would be true always.

    If you modifies the previous conditional statement as follows, the issue would be solved:

    if( fieldname1 != 0 && (fieldname1 > 330 || fieldname1 < 5)) return ‘Price on its way via email’;

    Applies the same logic to the other conditional statements where are present dependent fields.

    Best regards.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘If statements not working’ is closed to new replies.