Title: If statement
Last modified: August 30, 2016

---

# If statement

 *  Resolved [Javy26](https://wordpress.org/support/users/javy26/)
 * (@javy26)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/if-statement-7/)
 * Thanks for this plugin, really awesome. Am trying to figure out what am doing
   wrong. I have a field named “total charges” what I want is for it to be determined
   by what users entered in “fieldname2.” if the number entered in fieldname2 is
   <=50 then it should be fieldname2*1 else if the number is >50 thne it should 
   be fieldname2*fieldname2. This is the formula I have:
 *     ```
       (function(){
   
       if (fieldname2<=50)return fieldname2*1;}
       else if(fieldname2>50)return fieldname2*2;}
       ```
   
 * What am I doing wrong?
 * [https://wordpress.org/plugins/calculated-fields-form/](https://wordpress.org/plugins/calculated-fields-form/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/if-statement-7/#post-6796615)
 * Hi,
 * You have entered in the equation an additional curly brace symbol, and have not
   used the correct format for the function. Please, uses the following equation:
 *     ```
       (function(){
       if(fieldname2<=50) return fieldname2*1;
       else if(fieldname2>50) return fieldname2*2;
       })()
       ```
   
 * Best regards.
 *  Thread Starter [Javy26](https://wordpress.org/support/users/javy26/)
 * (@javy26)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/if-statement-7/#post-6796626)
 * Thank you
 *  Thread Starter [Javy26](https://wordpress.org/support/users/javy26/)
 * (@javy26)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/if-statement-7/#post-6796627)
 * is there a way to implement a button? Meaning when clicked it performs the calculations
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/if-statement-7/#post-6796671)
 * Hi,
 * Yes of course, please, follows the steps below:
 * 1. Activates the “Form Settings” tab, in the forms builder, and untick the checkbox:“
   Eval dynamically the equations associated to the calculated fields”
 * 2. Insert a button in the form, and then in its attributes, tick the option: “
   calculate” as the button type.
 * and that’s all.
    Thank you very much for using our plugin.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘If statement’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

## Tags

 * [if](https://wordpress.org/support/topic-tag/if/)

 * 4 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/if-statement-7/#post-6796671)
 * Status: resolved