# Dependent Field Logic Using Single Line Text Field

**URL:** <https://community.hubspot.com/t/dependent-field-logic-using-single-line-text-field/92000>\
**Category:** Lead Capture Tools\
**Tags:** forms\
**Created:** [October 17, 2023, 5:20pm UTC](https://community.hubspot.com/t/dependent-field-logic-using-single-line-text-field/92000 "2023-10-17T17:20:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MGraham57](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@MGraham57](https://community.hubspot.com/u/MGraham57)\
**Post date:** [October 17, 2023, 5:20pm UTC](https://community.hubspot.com/t/dependent-field-logic-using-single-line-text-field/92000/1 "2023-10-17T17:20:55Z")

</div>

I’m trying to use dependent form field logic based on what’s typed in a single line text field.

We want to try to use standard HubSpot field which is mapped to a standard Salesforce field. The standard HubSpot field (Industry) is a single line text field.

Unfortunatly, contacts can input whatever they want and in different formats (uppercase or lowercase, synonyms, abbreviations, ect). I tried to input a variety of field inputs to cover all basis however when its tested it does not work. It only works with one word is populated, not multiple seperated by a comma or semi colon.

If this were a picklist or any other field type this would be easier and a non-issue. Just wondering if there is documentation or recommendations on using single-line text fields for form logic.

---

<div class="post-metadata">

**Author:** ![himanshuGupta](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshugupta/32/23827_2.png) [@himanshuGupta](https://community.hubspot.com/u/himanshuGupta)\
**Post date:** [October 17, 2023, 5:53pm UTC](https://community.hubspot.com/t/dependent-field-logic-using-single-line-text-field/92000/2 "2023-10-17T17:53:31Z")

</div>

Here are a few ways to handle field arguments based on a single line text field in HubSpot:

- Use the `contains()` function to check if the text field contains any keywords. Example:

```  
if (contains(services, “construction”) || contain(services, “vehicle”)){  
//Show construction locations  
} . } . } . } .  
```

This will work if the industry also contains “construction” or “vehicle” in comma-separated characters.

- Use the `startsWith()` or `endsWith()` function to determine whether the text begins or ends with a value.

- Split the text field into an array using `split()` and loop through the array to check for the keyword.

```  
var jobs = partition(jobs, “,”);  
for (var i = 0; i \< tasks.length; i++){  
if(services[i] == “Technology”){  
//Display tech fields  
} . } . } . } .  
} . } . } . } .  
```

- Use hidden fields to store standardized industry values ​​and search against them rather than raw text fields. You can fill the hidden field with workflow or JavaScript.

- Consider changing the text to a multi-select checkbox field for projects to make understanding and standardization easier.

The main challenge with free text is to account for formats, spellings, abbreviations, etc. Functions such as `contains()` and partitions into arrays can help solve this logically Standardization of values is also recommended at Forms Summit.  
Let me know if this helps!

| 

| | 
## Madhur Gusain
Marketing Operations SpecialistGrorapid Labs | | | | 

| 

| ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/f/df8ab0b76490437a0abf747fa46bfe096cf763c9.png) |

 | +918287977394 |
| 

| ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/9/992ff01c4147f751a8a53f26652ceccd4d6469c6.png) |

 | [hello@grorapid.com](mailto:hello@grorapid.com) |
| 

| ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/2/520394ca2408f265ba1533bc5831a595c1d8670a.png) |

 | [https://labs.grorapid.com/](https://labs.grorapid.com/) |

 |

 |
| 

| |
| |
| |

 |
| 

| |

 |
| |
| [Create Your Own Free Signature](https://www.hubspot.com/email-signature-generator?utm_source=create-signature) |
