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!

### Send Comment

### 23 Comments...

## Related Forum Questions

- How can I set a calculation for my application form?
- Is there a way to use condition within the subject line or body of the autoresponder email?
- How to use show/hide conditions
- How to insert text into PDF in autoresponder email to client
- Booking form with Pricing based on From and To locations
- Run time constants. Feature request or bug report?
- How do I add on a questionnaire - "Address is different from above" with the option to check the box and the address field would appear.
- Conditions help? Can we..
- Auto reply notification WITH conditions?
- Conditions don't work on an embedded form

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

admirgvHi I need to calculate the square meter

if you can help out with the formula?

THX

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

agemoYour example is not working. Besides, I cannot set different values for different choices. It is not working. It shows empty textbox for choices other than first one.