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

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

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

To learn more about this, here's my test form https://www.jotform.com/61551439806964. We'll use it as a reference for the steps mentioned below.

1. On Form Builder, go to **SETTINGS** > **CONDITIONS**.

2. Then select the **UPDATE / CALCULATE FIELD** option.

3. First, setup the **IF STATEMENT** - This is the rule that needs to be met for the conditional logic to trigger its action. Then, setup the **DO STATEMENT** to **CALCULATE A FIELD'S VALUE**.

3A. Below is a screenshot to where we can do a calculation using the input from other fields. In my case, I will add the textboxes

NUMBER 1andNUMBER 2then output it on a textbox namedTOTAL. This conditional action will happen onlyIFtextboxNUMBER 1 IS FILLEDout. You can see this on my test form.You can add the other form fields by clicking the

ADD FIELDbutton. Make sure that the fields are set to 0-9, meaning their value is numeric. You can also insert your own formula here, you can see the number pad at the right side and the math functions there.After clicking the

SAVEbutton, this is how it looks like in myCONDITIONS LIST.Here's how it looks like in live

FORM PREVIEW:3B. Now how to insert a static text? Simply type the text in the textarea field under the

DO STATEMENT. Set the target field where you want to output the text. In my case, this conditional action happens when the specific drop down field in my form is set toYES. Notice that the background color is different from a numeric input. It should have a LIGHTBROWNbackground (for texts)instead of BLACK(for numbers).This is how it looks like in my

CONDITIONS LIST:This is how it looks like in live

FORM PREVIEW:

4. 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:

How to Populate Field with a Value from Another Field

How to Manipulate Text String with Conditions and Calculation

Got questions? Please let us know below!

**Contact Support:**

Uchechukwu MaduagwuHi ,

Can I populate a field in jotform from a field in my fillble PDF form?

username2481Doesn't work with "Full Name" field

Vishal PatelRoundoff Condition

selectabilitySilly question, the rule I have used to calculate numerous fields is the same as the example above. However, my answers will always be over 100. How do I get around this? I am getting an error if the answer is over 100. Thanks

itgotchanetauIm using the NAME field on my form showing the first and last name options.

I want to be able to copy ONLY the last name value to another field on the same form.

How do I do this?

I can get it to copy the first and last name but I only want the last name value...

scrubsavvyi am using multiple single choice templates that have different units for each choice. i want to add the units accordingly...regardless of the place in the single choice menu. Ex. single choice 1: in this order 1A 2B 3C 4D. single choice 2: in this order 1D 2A 3B 4C. if the chosen answers are single choice #1 (1A) and #2 (2A), i would like to use the conditional logic to add them to make 3A

please advise

JohniejotThank you. However, I am trying a create a form with a few questions each with a yes or no option. How to a do a calculation to sum up the Yes answers

C2BendWould this work to create a coupon code - IF code entered - discount is applied to total? and if so, could you show me how... also with a minimum amount needed

OrganicTouchCan you help me! Here is what I'm attempting to do

I'm creating order form.

Ex:

500mg Tinctures $35 each x 2 = $70

1000mg Tinctures $50 each x 5 = $250

2000mg Tinctures $70 each x 3 = $210

Total cost $530

MarcofxTanks for jotform

MOFA2020Thank you for this

amraouiahcenehello,

how to put a minimum price of 20 € in the field "price"

(I mean that all prices below 20 € must display 20 €).

Regards

Team_CateringI have a question regarding conditional logic + calculations.

IF CATERING ORDER is > $300 then delivery becomes an option. If delivery is selected, then 5% additional cost is added to their bill.

IF CATERING ORDER is < $300 then pick up at store is required and delivery is not shown as an option.

Can this logic be set up?

Thank you!

b370nI'm running a swiftlet nest business, we buy supplies every week and the number of grams are always different, and the price is also always different depends on the supplier, how do I auto calculate my purchase price

2briancoxI have a switch at the top of my page that is millimeters or inches. (mm by default)

Then I have a list of a bunch of measurements. I am trying to add the code so that clicking the Inches on the switch divides all measurement values by 25.4. But I always get a value of 0.000 when I do this.

Example code:

IF Units IS EQUAL TO "Inches"

INSERT {Pitch}/25.4 INTO Pitch

How do I make this work?

ivoryleagueIs it possible to create conditional logic with Product options? Here's what I want to do for conference registration options:

Register for 3 Days

Register for 5 Days

IF "Register for 3 Days" is added to cart

SHOW Product Option "Add ONE additional conference day"

I'm not seeing a way to do so, just thought I'd ask. Thanks!

kisenhartIf I have 145 questions set to add up at the end 1 point each, and I have a question that is N/A for instance, the form would be out of 144 questions then. How do I calculate that correctly?

pjm.mcnabJotform does not like circular references

RedcatOPSHi there,

If i got multiple "update/calculate filed" conditions, in what order do they get applied?

top to bottom or bottom to top?

Regards,

Malin

KatsumiGood Tool. I would like to do the same as 3B with the following:

A) hide text box 2 (i know how to do that)

B) receive text box 2 value in a email. With unhide field I know how to do

Regards,

CSBRAGAhow can I add in a static price list by product to calculate depending on the amount put in the table?

cris74how to calculate if a date entered on the form is greater than today plus 4 days?

williamdarvenizahow can I make the value of all multiple choice question add up?

hiraieikaiwaGood Explanation. I would like to know how to the same operation but the output field should result in an empty value.

Here is my outline.

I have two fields with single choice fields and an image.

Field 1) Single choice (visible) (show the image) (image and field 2 hidden when field 1 is not filled)

Image) hidden

Field 2) Single choice (hidden) (hide the image)

If the user selects "show the image", it triggers to show the image and field 2.

If the user then selects "hide the image" (field 2), then the condition should empty field 1, resulting in field 2 and the image be hidden again.

So, if the condition is met, the single choice field (field 1) should be updated/calculated to be empty.

How can I get this to work?

Would appreciate your help.

fadessiHello, I'm going to apply the compound interest calculation into the form. I'm in need to write this formula: ((a/b)^(1/c))-1 where a, b and c are input fields. I have written the formula as ((field2/field1)exp(1/field3))-1 and it doesn't work. Then I've tried ((field2/field1)pow(1/field3))-1 and it doesn't work too.

How can I solve this issue?

Thanks

Jordan ChildsWe use jotform for our special events insurance agency. I'm currently building a form with 2 products and these products have minimum premiums (stated more simply- regardless of the quantity of a product selected the minimum the customer will pay is "x").

Is there a conditional statement I can use to implement a rule like, "The minimum payment is $140 even if the combined value of number of products and price per product x is less than $140"?

Thank you!

winnie_joHello is there a way to use an external matrix file with numbers to use as

input with the " Calculation" widget or some alternative.

cvcliniquethis technique worked but there were various examples within the jotform forum that are similar but not very clear. this is quite big topic and some of the older support entries may need a tidy-up.

BabyandCompanyI'm trying to use this feature to calculate a cumulative value based on the responses to multiple choice questions. For example:

If answer to question 1 is yes, add 1 to TOTAL RISK SCORE

and

if answer to question 2 is yes, add 1 to TOTAL RISK SCORE

and

if answer to question 3 is yes, add 1 to TOTAL RISK SCORE

such that if answers to questions 1, 2, and 3 are all yes, TOTAL RISK SCORE would equal 3 (1+1+1)

I can't get the TOTAL RISK SCORE field to accumulate/add these individual risks - it seems that each one over-writes the others. Is there a proper way to do this where the responses to different questions could add to a certain field and that field will display the sum of all numbers added?

Thank you.

stashofmeI need help. I am trying to do a mortgage calculation but I cannot get the answer to display.

KristenRossCan you create a blank text box that the can be filled when a choice in a multiple choice box is checked?

AngelaI have 3 scenarios from my form: total is less than 50, greater than 49 and less than 100, greater than 99... I have a 3 hidden text boxes that I want to add to a blank text box depending on the result. This will be included in my email to the people who fill out my form. Can't seem to get it to work correctly. Thanks for any suggestions.

K9TrioHi, I have a multiple choice field, I would like to put a total depending on what they chose. If they chose just one it's $125, if they choose 2 it's 10% off, 3 15% off, 4 20% off. I'm not sure what the conditional logic would be? Or do I have to have each of these in their separate field? Any help appreciated, formulas aren't my best thing.

handsofpeaceThis is not working for me on my UnGala form - I am trying to have the values linked to the cost of each activity in question 1 automatically populate the Donation Amount field. No matter how I set up the conditional logic it won't work. I suspect this is because Authorize.net's payment widget includes the donation amount, cc info, and billing address. Please advise! I need to find a workaround.

sckupermanI have a form that, when the user enters a number into one field, multiple conditions exit to *SHOW* a series of three corresponding fields depending upon the quantity typed into the first field, up to a maximum of four. For example, the main, first field requests a number from zero through four... If a user enters "2", then six fields will unhide.

Additional conditional logic declares that if the subsequent series of three fields show, that the second field of each unhid series is then *REQUIRED*. Furthermore, if the second field (single choice radio buttons) in the series is selected as "yes", then the third field (text box limited to 12 alphanumeric characters) is also *REQUIRED*.

My question is this: If a user enters "2", or "3", or "4" into field #1, and then selects "yes" for any series field #2, and enters any text into any series field #3... But then reduces the number entered into field #1,

How can I reset the choice to 'none chosen' in the series field #2, AND reset the series field #3 to have no entry???

JonathanHello,

Can I have the results display 3 different types of pricing depending on the user's selection?

For example, if a user says they are 1. A certain age (say 30 years old), and 2. Are single, and 3. Are male, can we have 3 different price points display depending on the selections?

Any help is greatly appreciated!

bpugh22Our teachers need to enter 1 or more form fields with a list of text items. The sub menu reminds them to enter a comma after each item, followed by 1 space.

Is there a way that a condition can be set up so that if a teacher forgets to enter the commas/spaces, that their entry will be rejected until they do?

millionairemossI have a 10 question quiz with mainly yes or no values being either 1 or 2. I would like the quiz to auto score at the end and take them to a page where they enter their email address and name to be added to my email list. How can I assign numerical values to text in my form and have those values calculate at the end of the form? This tutorial does not help with that.

JS2706How would I calculate the cost ($35/night) based on total number of nights, which is fixed until the 7th night, and then there's a discount. There is an additional $10 discount after every 7 nights... so for example, 3 nights would be $105, 9 nights would be $305, and 15 nights would be $505.

I would also like to add in other fields to this number, but not sure how to do it from a drop down menu with many different choices.

Any help would be greatly appreciated!

AnnaNCeldranif i want a name to have a maximum of 22 characters (letters) not including spaces in between and not counting the comma and period how do I encode in it the condition box?

in the update/calculate field i was able to do this: surname (a-z)(,)(space) first name (a-z) (space) middle initial (a-z)(.) total: name but I want to put a condition that states that the total number of characters should be less than or equal to 22 then ok but if total characters is greater than 22 then error

JS2706Wondering how I would show the total number of nights from the Check in and Check out fields. Kind of like hotels do.

KCCwebservicesHow do you use this update/calculate a field within the Matrix Dynamique widget?

cris74How insert 14/04/2016 in date field, when another field is equal to "yes" ?

natalieuHi, I've added some update form values - depending on answer different text - and I want this "calculation" to show up in the autoresponder results.

Although I've added the field the output doesn't show up. What have I missed?

For example if bullet point 2 is selected, the text says bullet point 2 answer - that's what I want to show up in the email. Is that possible and if so how?

uxindiaI want to use conditional statement auto counter. when auto counter hits limit set it should throw exception to the user not to submit form.

Ex: I have a radio button with four values (A, b, c, d). If either of this value auto increments to 100, i would like to restrict new users from submitting form. how do i achieve this

branzburgI was trying to get this feature to work with text. If I have a field "NAME" and a field "CITY" can it concatenate the two fields? For example, if the NAME field contains "Joe" and the CITY field contains "London" I'd like a 3rd field to automatically contain "Joe London"

GordonI am looking at a conditional expression that sets a minimum price .... eg if [calc_result 1] * [calc_2]< 40 then [answer] = 40

chrisgalCan i use "And" contition somehow?

I have 2 drop down fields and 1 calculation field. For example: if user choose "option 1" form the 1st field and "option 2" on the 2nd field then in calculation field a price appears. There is 10 options in 1st field and 10 options in 2nd field. Diferrent prices for diferrent options. How can i do this?

ecoconsumerwhen creating any formula, the wizzard doesnt seem to save the formula...

csanders_watpacI have three spinners in my questionnaire.

I was hoping to use the choice of the first to automatically set the default minimum of the second and third but can see no way to do that.

i.e. First spinner = Number of support persons within my state = 6 therefore the number of support persons within my Country cannot be any LESS than 6 so I would like the number chosen at State level to set the minimum at Country and International levels for my second and third spinners