How to Manipulate Text (String) with Conditions and Calculation

December 6, 2023

When integrating forms with your current existing workflow, often, you’ll find yourself stuck on something particular. Let’s take, for example, the following:

No matter what the use case may be, knowing how to manipulate texts (strings) would be a massive help in building interactive forms. So in this guide, we’ll focus on the Use Cases mentioned above. Your imagination and creativity would only go as far as how you understand Conditions and Calculations.

Youtube Embed Poster: aBS95KPa5C4

If you’re eager to check the result, check the following demo form.

Generate URL Based on User Input

Add the fields you need to create the URL. For example, Dropdown and Single Choice elements as shown from the given demo form. And don’t forget to add the Short Text Entry element where the condition generates the URL.

text-strings-generate-url

Next, set up your conditional logic as follows.

text-strings-conditional-logic-to-generate-url

As you can see, there are no operators between texts and elements. You only need to type the texts and add the fields between them.

https://mydomain.com/checkout.php?prod={addFieldHere}&custom={addFieldHere}

Generate Email Address

Add the elements needed to generate a well-formed email address. The part before the @ symbol identifies the name of a mailbox. It is often the username of the recipient, e.g., johndoe. The part after the @ symbol is a domain name representing the mailbox’s administrative realm, e.g., example.com, the company’s domain name.

In the given demo form, you’ll find the Short Text Entry element that serves as the name input and a Dropdown where the domains are listed.

text-strings-generate-email-address

The conditional logic would be the following:

text-strings-conditional-logic-to-generate-email-address

Like the previous method, you won’t need to use operators to concatenate texts/strings. Just type them in – this time, you add the Short Text Entry, an @ symbol, then the Dropdown field.

{addFieldHere}@{addFieldHere}

Generate a Comma-Separated Set of Values

Lastly, to achieve this, the same principle still applies. Just add the element needed and append the comma between the elements while ensuring you render them as Texts. For example, we have two (2) Single Choice and Dropdown elements.

text-strings-generate-comma-separated-values

The conditional logic to generate the comma-separated values:

text-strings-conditional-logic-to-generate-comma-separated-values

Notes:

  • Anything you manually type in the Calculate screen will be treated as text by default (with brown background).
  • Any field you add (when you click the Add Field button) will be added as a number by default (with black background).
  • If you wish to toggle back and forth from text to number (and vice versa), click on each block.
  • Pressing the Tab key will automatically render the text you typed as a block of text/string.
Academy Logo

Introduction to Form Building

Adding Conditional Logic Elements

Go to course :Adding Conditional Logic Elements
lesson-2 - image
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:

  • Rolando Ferres - Profile picture
  • discoverability diagnostic - Profile picture
  • Alma Institute - Profile picture
  • Kristen Hughes - Profile picture
  • Biswadeep Mukherjee - Profile picture
  • Maxima People & Culture - Profile picture