Support » Plugin: Calculated Fields Form » How to use dropdown and checkboxes in equation

  • Resolved ujalarehan3

    (@ujalarehan3)


    Hello
    I want to know that how to use drop down values in equation like if i am making a calculator of HP and WATTS conversions and i am giving a drop down list which allow users to select unit type for their result so can you plz help me how to do it i am also attaching a link which will let you know that what i want
    calculator

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

    (@ujalarehan3)

    Plz send video tutorial because i am so confused

    Plugin Author codepeople

    (@codepeople)

    Hello @ujalarehan3

    1 HP = 745.7 Watt

    So, I’ll try to describe the process with a hypothetical example:

    Assuming there are three fields in the form:

    * The fieldname1 is a number field that allows the users to enter the values.

    * The fieldname2 is a dropdown field with two choices for “From”:
    – First choice with text: HP, and value: hp
    – Second choice with text: Watt, and value: watt

    * The fieldname3 is another dropdown field for “To” with the same choices of the fieldname2 field.

    Now, you only should insert a calculated field in the form with the following equation:

    
    (function(){
    if(fieldname2 == 'hp' && fieldname3 == 'watt') return fieldname1*745.7;
    if(fieldname2 == 'watt' && fieldname3 == 'hp') return fieldname1/745.7;
    return fieldname1;
    })()
    

    And that’s all. The process is very simple.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to use dropdown and checkboxes in equation’ is closed to new replies.