# Seeking a Clean Solution: Controlling Required Fields in a Reusable Element"

**URL:** <https://forum.bubble.io/t/seeking-a-clean-solution-controlling-required-fields-in-a-reusable-element/308272>\
**Category:** Need help\
**Created:** [February 19, 2024, 6:13pm UTC](https://forum.bubble.io/t/seeking-a-clean-solution-controlling-required-fields-in-a-reusable-element/308272 "2024-02-19T18:13:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvioavilla](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@sylvioavilla](https://forum.bubble.io/u/sylvioavilla)\
**Post date:** [February 19, 2024, 6:13pm UTC](https://forum.bubble.io/t/seeking-a-clean-solution-controlling-required-fields-in-a-reusable-element/308272/1 "2024-02-19T18:13:43Z")

</div>

Hello, guys. How are you?  
Is there a clean way to control required fields on a reusable element? I have a reusable element inside a form. The form itself will create a datatype (dtA), and the reusable element will create another datatype (dtB - related to “its parent”). So, I created a button on the form that will create dtA and will set a state on the reusable element to create dtB. Since I’m not creating dtB directly, the “this input should not be empty” is irrelevant.  
I could make some kind of manual control (in fact, it’s what I’m doing) to check if the inputs are not empty… but that creates a mess and is not very clean.  
I appreciate if someone could help me with this one!  
Thanks!

---

<div class="post-metadata">

**Author:** ![DjackLowCode](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/djacklowcode/32/222536_2.png) [@DjackLowCode](https://forum.bubble.io/u/DjackLowCode)\
**Post date:** [February 19, 2024, 7:27pm UTC](https://forum.bubble.io/t/seeking-a-clean-solution-controlling-required-fields-in-a-reusable-element/308272/2 "2024-02-19T19:27:31Z")

</div>

If the form is static, one option is to create a property on the reusable using the required inputs - i.e they aren’t empty (y\n) and reference that

---

<div class="post-metadata">

**Author:** ![sylvioavilla](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@sylvioavilla](https://forum.bubble.io/u/sylvioavilla)\
**Post date:** [February 20, 2024, 6:20pm UTC](https://forum.bubble.io/t/seeking-a-clean-solution-controlling-required-fields-in-a-reusable-element/308272/3 "2024-02-20T18:20:50Z")

</div>

Hey @DjackLowCode , thanks for the answer.  
If i understood correctly, the ideia is to create a custom state ( yes/no) on the reusable. Then a WF to change the status to YES whenever the input is changed and is not empty. Repeat that for all the required fields…  
On the Form Button, put a conditional that, if one of the custom states on the reusable is NO, show an alert… if all are YES, proceed with the WF.

Is that it?

---

<div class="post-metadata">

**Author:** ![DjackLowCode](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/djacklowcode/32/222536_2.png) [@DjackLowCode](https://forum.bubble.io/u/DjackLowCode)\
**Post date:** [February 20, 2024, 6:58pm UTC](https://forum.bubble.io/t/seeking-a-clean-solution-controlling-required-fields-in-a-reusable-element/308272/4 "2024-02-20T18:58:50Z")

</div>

@sylvioavilla - that’s the right idea. You can use the ‘property’ feature on the reusable so that it updates dynamically rather than having to set the custom state every time

---

<div class="post-metadata">

**Author:** ![sylvioavilla](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@sylvioavilla](https://forum.bubble.io/u/sylvioavilla)\
**Post date:** [February 20, 2024, 7:31pm UTC](https://forum.bubble.io/t/seeking-a-clean-solution-controlling-required-fields-in-a-reusable-element/308272/5 "2024-02-20T19:31:36Z")

</div>

Ok, that makes much more sense, lol!

After trying your suggestion I found a cleaner solution.

Inside the reusable I created a Custom Event to Create/Edit the new record.  
On the form, I set a WF for the button to first trigger the Custom Event Inside a reusable and then do the next steps. That triggers the required rules within the reusable, preventing the user to save empty fields!

Thanks again @DjackLowCode for your help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [April 29, 2024, 6:14pm UTC](https://forum.bubble.io/t/seeking-a-clean-solution-controlling-required-fields-in-a-reusable-element/308272/6 "2024-04-29T18:14:20Z")

</div>

Closed on April 29, 2024, 6:14pm UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
