WordPress.org

Ready to get started?Download WordPress

Forums

Calculated Fields Form
[resolved] need assistance to create formula (2 posts)

  1. donowhattodo
    Member
    Posted 1 year ago #

    Hello there.
    first of all i would like to thank you for this great plugin.
    i am in the midst of creating a form. please assist me with the calculation below:

    fieldname1: 1,2-3,4-7,above 8
    fieldname2: 100
    fieldname3: 200
    fieldname4: 300
    fieldname5: 400

    calculated field: if they select 1 then the value is fieldname2
    if they select (2 OR 3) then the value is (fieldname1*fieldname3)
    if they select (4,5,6,OR 7) then the value is (fieldname1*fieldname4)
    if they select (above 8) then the value is (fieldname1*fieldname5)

    http://wordpress.org/plugins/calculated-fields-form/

  2. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    I suppose the fieldname1 is a radio button group, or a drop-down field, with options' values:1,2,3,4,5,6,7,8,...

    So the equation would be:

    (function(){
    if(fieldname1 == 1) return fieldname2;
    if(fieldname1 == 2 || fieldname1 == 3) return fieldname1*fieldname3;
    if(fieldname1 == 4 || fieldname1 == 5 || fieldname1 == 6 || fieldname1 == 7) return fieldname1*fieldname4;
    if(fieldname1 >= 8) return fieldname1*fieldname5;
    })();

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.