# Question regarding dependent fields within a form

**URL:** <https://community.hubspot.com/t/question-regarding-dependent-fields-within-a-form/93985>\
**Category:** CRM\
**Tags:** forms, professional\
**Created:** [November 14, 2023, 3:19pm UTC](https://community.hubspot.com/t/question-regarding-dependent-fields-within-a-form/93985 "2023-11-14T15:19:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wijtmans](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wijtmans/32/221530_2.png) [@Wijtmans](https://community.hubspot.com/u/Wijtmans)\
**Post date:** [November 14, 2023, 3:19pm UTC](https://community.hubspot.com/t/question-regarding-dependent-fields-within-a-form/93985/1 "2023-11-14T15:19:27Z")

</div>

Hi all,

I have come across a problem when creating a submission form. I have searched the forums for a definite answer, but I did not come across a similar situation, or at least not for my understanding.

**Situation:**

For example, I am trying to create a form that will provide me with information for one of three scenarios:

1. **Dropdown menu** : where you can choose to provide the name of one, two or three contacts, with each choice showing a different follow-up.
2. **Dependent field choice for 1 contact** : shows you the field to provide details on 1 contact via property [contact\_name\_1].
3. **Dependent field choice for 2 contacts** : shows you the fields to provide details on 2 contacts via properties [contact\_name\_1] and [contact\_name\_2].
4. **Dependent field choice for 3 contacts** : shows you the fields to provide details on 3 contacts via properties [contact\_name\_1], [contact\_name\_2] and [contact\_name\_3].

So if you were to select ‘1 contact’, you would get 1 property field. When you select ‘2 contacts’, you will get 2 property fields, etc.

**Problem** :

The problem is when I try to apply this logic, it gives me a warning saying ‘the form has a duplicate field’, which confuses me. We established that if you make a choice, you will see the properties that match that choice, hence there will be no duplicate fields.

If my theory is correct, it suggests i need to do the following:

- I need to create the following property for the option ‘ **1 contact** ’ [contact\_name\_1].
- I need to create the following properties for the option ‘ **2 contacts** ’ [contact\_name\_1.2] and [contact\_name\_2].
- I need to create the following properties for the option ‘ **3 contacts** ’ [contact\_name\_1.3], [contact\_name\_2.2], and [contact\_name\_3].

If this is the case, it would overcomplicate the process and flood the system with unnecessary data that needs to be combined afterwards.

Hopefully, someone is able to clear this up for me and steer me in the right direction. All help is welcome!

---

<div class="post-metadata">

**Author:** ![PamCotton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pamcotton/32/47916_2.png) [@PamCotton](https://community.hubspot.com/u/PamCotton)\
**Post date:** [November 14, 2023, 10:17pm UTC](https://community.hubspot.com/t/question-regarding-dependent-fields-within-a-form/93985/2 "2023-11-14T22:17:15Z")

</div>

Hello @Wijtmans thank you for posting in our Community!

You can only add dependent form fields to a regular form field. You cannot add a level or layer to a dependent form field. For example, you cannot add a dependent form field to an existing dependent form field, [more information here,](https://knowledge.hubspot.com/forms/use-dependent-form-fields#:~:text=You%20can%20only%20add%20dependent%20form%20fields%20to%20a%20regular%20form%20field.%20You%20cannot%20add%20an%20additional%20level%20or%20layer%20to%20a%20dependent%20form%20field.%20For%20example%2C%20you%20cannot%20add%20an%20additional%20dependent%20form%20field%20to%20an%20existing%20dependent%20form%20field.)

I want to invite our top experts @Josh @franksteiner79 [@Mike\_Eastwood](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259) any recommendations to @Wijtmans matter?

Thank you,

Pam

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [November 15, 2023, 6:07am UTC](https://community.hubspot.com/t/question-regarding-dependent-fields-within-a-form/93985/3 "2023-11-15T06:07:43Z")

</div>

Hi @Wijtmans

The dependent fields are useful for simple logic, as soon as things get a little complicated the only way to handle it is with custom code.

The way I would handle it is to create a Custom Module, that holds the HubSpot Form (which must be set to Raw HTML). You can then [customise the Embed Code](https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options) in the Module to manipulate the Form with JavaScript. In your form you will need to show all the hidden fields and hide them with JavaScript if you hide the fields the JavaScript cant targte the fields.

If your eyes glazed over and you think I’m speaking a foreign language - that’s understandable - I’m a geek. And, it’s a reasonably geeky job to do.

Have fun

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of [Webalite](https://www.webalite.com?utm_campaign=community-forum&utm_source=community&utm_content=signature) a Gold HubSpot Partner Agency based in Wellington, New Zealand and the founder of **Portal-iQ** the world’s first automated [HubSpot Portal Audit](https://portal-iq.com?utm_campaign=community-forum&utm_source=community-forum&utm_content=signature) that helps you work smarter with HubSpot.

---

<div class="post-metadata">

**Author:** ![Wijtmans](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wijtmans/32/221530_2.png) [@Wijtmans](https://community.hubspot.com/u/Wijtmans)\
**Post date:** [November 15, 2023, 9:06am UTC](https://community.hubspot.com/t/question-regarding-dependent-fields-within-a-form/93985/4 "2023-11-15T09:06:21Z")

</div>

Thank you for your answers [@Mike\_Eastwood](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259) and @PamCotton.

So it is linked to a layer. I thought (hoped) my case was different, but it probably makes sense in the backend.

As for generating custom code, I need most of the forms to be uniformly applicable to decrease operating costs. Not to mention that I have only performed a couple of Codecademy courses, so in no way am I qualified to take on this challenge!

Seems that I have to make do with single layer structures, which will do the trick in some way. It just doesn’t look as good as an unfolding structure. I think i will create ‘buttons’ to unfold the creation of a second and third contact.

Thanks again for the insights!
