Support » Plugin: Calculated Fields Form » Assign value to input “number” field

  • Resolved cncladmin


    Hi again,

    I did just upgrade to the Pro version (your assistance has definitely been worth it). This should be my last question:

    I’m wanting to use a “calculated field” to assign a number value to a user input “number” field.

    Essentially I’d like for users to be able to toggle back and forth between “grams” and “calories”, and when they input a value into the “grams” field, the form will automatically assign the corresponding value to the “calories” field and vice versa.

    I tried:

    var beefgm=fieldname17;
    var beefcal=fieldname17*2.4;

    (to assign the value of fieldname17 into fieldname77)…but it didn’t work. Is there some way to do this?


    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • I worked out the solution to this problem out on my own (I found another message in your forum that answered the question), and it’s working great. So no need to respond.

    However, a different question: Now that I upgraded to “pro” version, the “Security” field automatically shows up on the bottom of the forms, and I can’t work out how to turn it off (I’d prefer not to have it since it’s not necessary for the way I’m using these forms).


    Plugin Author codepeople


    Hello @cncladmin

    First, if you want hide the captcha, go to the form’s settings, and select the “No” option for the attribute: “Use Captcha Verification?”, and that’s all.

    Now, your question about the equation. As fields depends on each other, you should identify first the field that has been edited manually by the user. I’ll describe the process with a hypothetical example:

    1. Insert two calculated fields, fieldname1 and fieldname2, for “Grams” and “Calories” respectively, and untick the “Read only” checkbox in the settings of both fields. So, these fields are at the same time input fields and calculated fields.

    2. Insert a “HTML Content” field in the form with the following piece of code as its content:

    var edited = '';
    jQuery(document).on('keydown', '[id*="fieldname1_"]', function(){edited = 'gram';})
    jQuery(document).on('keydown', '[id*="fieldname2_"]', function(){edited = 'cal';})

    As you can see, the code above, it simply identifies which of fields have been edited manually by the user (keydown event), and enter the text ‘gram’ or ‘cal’ to the global variable: edited, depending on the field that is entered manually.

    3. Finally, the equations.

    The equation associated to the fieldname1 would be:

    IF(edited == 'gram', __ME__, fieldname2/2.4)

    The equation associated to the fieldname2:

    IF(edited == 'cal', __ME__, fieldname1*2.4)

    The description is very straightforward, so, I will describe only the first of them. If I’m the field that is being entered manually (edited == ‘gram’), then the equation returns my own value (the predefined constant: __ME__), but if the field that is being edited is the other one, then, the equation returns the calculated value that depends of the other field.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Assign value to input “number” field’ is closed to new replies.