• Resolved Asjad Aamir

    (@asjad492)


    Hi, Can you please tell what is issue in following statement as it is giving incorrect answer. If I remove other conditions and only use one, it gives correct answer.

    (function(){
    
    
    if (AND(fieldname6 == 'Buying additional residence', fieldname8 == 'Yes')) {
    
        if (fieldname7 < 40000) {
            return fieldname7*0;
        }
    
         else if (40000 < fieldname7 < 250000) {
    
        return (fieldname7-40000)*0.03;
    }
         else if (250000 < fieldname7 < 925000) {
        return SUM(250000*0.03,(fieldname7-250000)*0.08);
    }
    
    
    }
    
    })();
    
    
Viewing 15 replies - 16 through 30 (of 37 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    You are requesting a custom behavior. In this case, you should request a custom coding service via the plugin website:

    https://cff.dwbooster.com/customization

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    I am not requesting custom behavior. I am just referring to old thread in which you said that one field can be evaluated without dynamic evaluation option turning on. But now you are saying it can’t be done

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    I have described an alternative that you have not been able to adjust to your project. Therefore, you need someone to implement it for you, and we can no longer implement your project through the WordPress forum. If you need us to implement your project, do not hesitate to contact us via the plugin website.

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    What alternative you described? I couldn’t get it. I can’t find any second method in this thread. I am saying that I don’t want all calculated fields to be dynamically evaluated. I want one of them to be excluded from dynamic evaluating

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    In the current version of the plugin that is not possible without customizing its behavior via code.

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    But in one of previous threads (I shared link) you shared a method and it worked perfectly. This time the issue is there os a for loop. So I want to know how to write it under <script> tags as you shared code in last thread

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    Exactly, if you don’t know how to adapt the code to your new project, you can contact us via the plugin website.

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    For mt understanding, why you didnt use | n in the code under script tags?

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    Only the equations in calculated fields replace the fields names by their values. So, you don’t need it in the script tags.

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Could you please check it? I tried my best to adjust the code. Please tell if there is any error in it?

    <script>
    	fbuilderjQuery(document).one('showHideDepEvent', function(evt, form_id){
    
    var f = jQuery('[name="cp_calculatedfieldsf_id"][value="7"]').closest('form');  
    
      
    jQuery(f).on('change', '[id*="fieldname11_"]', function(){
    	var fields = [fieldname13, fieldname14, fieldname15];
    
    for(var i in fields){
        if(i<getField('fieldname11', f).val(true, true)) ACTIVATEFIELD(fields[i]);
        else IGNOREFIELD(fields[i]);
    }
    });
    		jQuery('[id*="fieldname11_"]', f).change();
    });
    </script>
    
    
    
    Thread Starter Asjad Aamir

    (@asjad492)

    Fieldname 11 is slider, and other are number fields

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    In your line of code:

    var fields = [fieldname13, fieldname14, fieldname15];

    The fields names are strings and must be enclosed between single or double-quotes symbols:

    var fields = ['fieldname13', 'fieldname14', 'fieldname15'];

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    All good now?

    <script>
        fbuilderjQuery(document).one('showHideDepEvent', function(evt, form_id){
    
    var f = jQuery('[name="cp_calculatedfieldsf_id"][value="7"]').closest('form');  
    
      
    jQuery(f).on('change', '[id*="fieldname11_"]', function(){
        var fields = [‘fieldname13’, ‘fieldname14’, ‘fieldname15’];
    
    for(var i in fields){
        if(i<getField('fieldname11', f).val(true, true)) {
    ACTIVATEFIELD(fields[i]);
    }
        else {
    IGNOREFIELD(fields[i]);
    }
    }
    });
            jQuery('[id*="fieldname11_"]', f).change();
    });
    </script>
    
    Thread Starter Asjad Aamir

    (@asjad492)

    Hi, up to 3 fields, it works. But as I increased number of fields, it isnt working.

    <script>
        fbuilderjQuery(document).one('showHideDepEvent', function(evt, form_id){
    
    var f = jQuery('[name="cp_calculatedfieldsf_id"][value="7"]').closest('form');  
    
      
    jQuery(f).on('change', '[id*="fieldname11_"]', function(){
    var fields = ['fieldname13', 'fieldname14', 'fieldname15', 'fieldname16', 'fieldname17', 'fieldname18', 'fieldname19', 'fieldname20', 'fieldname21', 'fieldname22', 'fieldname23', 'fieldname24', 'fieldname25', 'fieldname26', 'fieldname27', 'fieldname28', 'fieldname29', 'fieldname30'];
    for(var i in fields){
        if(i<getField('fieldname11', f).val(true, true)) {
    ACTIVATEFIELD(fields[i]);
    }
        else {
    IGNOREFIELD(fields[i]);
    }
    }
    });
            jQuery('[id*="fieldname11_"]', f).change();
    });
    </script>
    
    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    I’m sorry, but the support does not cover the development of the users’ projects.

    Best regards.

Viewing 15 replies - 16 through 30 (of 37 total)
  • The topic ‘Using if else statement’ is closed to new replies.