• Resolved jamiewalden

    (@jamiewalden)


    I’m having trouble with the conditional fields.

    I’m trying to set a formula where if they select from a dropdown menu, each option in the dropdown results in a different calculation.

    The formula I’m trying to use is this:

    (function(){
    
    if(fieldname3==1){
    return (fieldname5*10);
    
    if(fieldname3==2){
    return (fieldname5*100);
    
    }
    })()

    The fieldname3 is the first field which is the dropdown, then fieldname5 is the second field the user fills out. But it’s not working.

    AND

    When I select from the dropdown, that field completely disappears. Could you please help? Thanks very much.

    See calculator here:
    https://www.americandatanetwork.com/test-3/

    https://www.ads-software.com/plugins/calculated-fields-form/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jamiewalden

    (@jamiewalden)

    Got this working with this:

    (function(){
    var v = fieldname3;
    if(v==1) return fieldname2*10;
    if(v==2) return fieldname2*100;
    })()

    Not sure why the dropdown was disappearing tho.

    Plugin Author codepeople

    (@codepeople)

    Hi,

    The issue in your first equation was related with the “}” symbols. You’ve used the equation:

    (function(){
    if(fieldname3==1){
    return (fieldname5*10);

    if(fieldname3==2){
    return (fieldname5*100);
    }
    })()

    but the correct is:

    (function(){
    if(fieldname3==1){
    return (fieldname5*10);
    }
    if(fieldname3==2){
    return (fieldname5*100);
    }
    })()

    Pay attention to the “}” symbol for closing the first conditional statement.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional Fields Formula Not Working’ is closed to new replies.