• Resolved Eric John

    (@hdgsnl-1)


    I’m not a programmer so this Plugin is very hard for me to use.

    The form builder is easy to use, but the hard part for me is the equation.

    I have three fields:

    [fieldname11]Radio buttons with two options
    [fieldname5]Field number
    [fieldname10]calculated field

    What I want is this:

    1. Select radio button
    2. Enter valute in fieldname5
    3. Show a fix calculation based on step 1 and 2. (it’s predefined does not need any calculation)

    Example

    1. Radio button one is selected
    2. A value of 10000 is entered
    3. the calculation will show a fix value

    —–

    Values by step 1 are:
    Y
    X

    values by step 2 are:

    0 – 10000
    10000 – 20000
    20000 – 30000
    30000 – 40000
    40000 – 50000

    —–

    Example 1 output

    1. Y
    2. 8000
    3. Calculation: 120

    1. X
    2. 8000
    3. Calculation: 95

    Example 2 output

    1. Y
    2. 18000
    3. Calculation: 190

    1. X
    2. 18000
    3. Calculation: 130

    I hope somebody can help me with this. Thanks in advance.

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

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

    (@codepeople)

    Hi,

    The equation would be very easy if you use conditional statements, like follow:

    (function(){
    if( fieldname11 == 'Y' && fieldname5 <= 10000 ) return 120;
    if( fieldname11 == 'X' && fieldname5 <= 10000 ) return 95;
    if( fieldname11 == 'Y' && fieldname5 <= 20000 ) return 190;
    if( fieldname11 == 'X' && fieldname5 <= 20000 ) return 130;
    })()

    You only should complete the other values combinations.

    Best regards.

    Thread Starter Eric John

    (@hdgsnl-1)

    Many thanks! That was easy.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Quick question’ is closed to new replies.