How to Insert Text or Calculation into a Field Using Conditional Logic

October 21, 2022

We have just implemented this as a new feature allowing the use of Calculations based on specific conditions.

  1. Go to the Form Builder’s Settings tab.
  2. Click Conditions on the left.
  3. Select the Update/Calculate Field option.
form-builder-conditions-update-calculate-field-min
  1. Set the DO statement to Calculate a field’s value.
my-builder-conditions-calculate-field-value-min

A new section will appear where you can add form fields by clicking the Add Field button.

form-builder-conditions-update-calculate-add-field-min

You can also insert values, operators, and functions using the virtual numeric keypad.

Perform Calculations

As an example, we’ll be using this simple multiplication fieldset consisting of 3 Number elements where we insert the product of the first two fields into the third:

sample-form-multiplication-min

The Conditional Logic would look something like the following:

sample-form-multiplication-conditional-logic-min

Notice the field labels have a trailing [0-9], meaning their value is numeric.

To break that down:

  • We’ve set the condition or IF statement to check if the Multiplicand field “Is Filled”.
  • The action or DO statement will insert the result of the expression “Multiplicand * Multiplier” into the Product field if the condition is met.

After clicking the Save button, this is what it looks like in my conditions list:

sample-form-multiplication-conditional-logic-shorthand-min

Insert Text

Now how to insert static text? Simply type the text in the textarea under the DO statement.

We’ll be using this fieldset consisting of a Single Choice element as the input field and a Short Text element as the output field for the condition:

sample-form-insert-hello-world-min

Here’s what its Conditional Logic looks like:

sample-form-insert-hello-world-conditional-logic-min

The setup will insert the text “Hello World” into the Output field if the Insert “Hello World” into Output field is a “Yes”.

sample-form-insert-hello-world-condition-shorthand-min

To learn more, here’s the demo form used for the steps mentioned in this guide.

Congratulations! You’re now able to insert static text or perform your own calculations using conditional logic.

Here are some related guides that you might also want to check out:

Got questions? Please let us know below!

END OF YEAR SALE
Save 50%
ON ANNUAL PLANS
Contact Support:

Our customer support team is available 24/7 and our average response time is between one to two hours.
Our team can be contacted via:

Support Forum: https://www.jotform.com/answers/

Contact Jotform Support: https://www.jotform.com/contact/

Send Comment:

Jotform Avatar
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Comments:

  • Suneel Shivdasani - Profile picture
  • Audif Photo  - Profile picture
  • Shift Academy - Profile picture
  • Fűzér Tamás - Profile picture
  • Uwe Samstag-Schnock - Profile picture