Support » Plugin: Calculated Fields Form » Conditional Values

  • Resolved lukegoldthorpe

    (@lukegoldthorpe)


    Hey,

    I recently posted about a salary calculator and you got back very quickly, therefore question number two is on its way!

    Is there any possible way of adding more conditional values to the calculated output area. I want to set it up so depending on what number is calculated, a different output field shows up. However I can only add 1 and I want to add 3: For example,

    If 0 = “Average”
    If > 0 = “Above Avg”
    If < 0 = “Below Avg”

    Any feedback is grateful as always!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @lukegoldthorpe,

    Assuming current equation is: fieldname1+fieldname2, it should be edited as follows:

    
    (function(){
    var v = fieldname1+fieldname2;
    if(v==0) return 'Average';
    if(v<0) return 'Below Average';
    return 'Above Average';
    })()
    

    And that’s all.
    Pay attention to the use of conditional statements (if) in the equation.
    Best regards.

    Thanks for this again,

    What I was meaning was not part of the equation it was a below option which states ‘If value is:….’ Then has a drop down for equal to, greater than etc.

    However, your answer has made me re-jig the form by doing it through the equation code and has made the functionality so much better. Thanks for your help!

    Plugin Author codepeople

    (@codepeople)

    Hello @lukegoldthorpe,

    You are talking about the dependencies. Through this section you can define dependencies between fields.

    For example, assuming there are two fields in the form (fieldname123 and fieldame567) that you want to display and mark as active when the result of the equation associated to the calculated field is zero. In this case you should define the rule: if the value is equal to 0, then select the field: fieldname123 through the drop down list, press the plus icon beside the drop down list, and select the fieldname567 through the new drop down list.

    The plus icon beside the validation rule allow you define more validation rules associated to the same result, for example if the equation’s result is greater than zero, etc.

    Best regards.

    Ah! Wow! This would make sense but I have not been able to do this because the ‘+’ and ‘x’ symbols have bugged and are invisible. On standard fields, I assumed where they would be and hovered until they showed up. Hard to explain, have screenshots to back up my point. But thanks again.

    Plugin Author codepeople

    (@codepeople)

    Hello @lukegoldthorpe,

    I guess the issue its caused by a conflict with the styles in the theme active on your website.

    Could you create a ticket in my private website for checking in detail the styles on your website, please?

    https://cff.dwbooster.com/contact-us

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.