Hi bubblers,
I need to allow my users to create as many custom fields with different field types (text, dropdown,…) as they need and then be able to store them.
What solution do you suggest?
You’ll need a ‘custom field’ data type
I do this with many of my apps. One is a Monday clone called Tuesday. They can add as many columns as they want with a lot of different types. Create a dataType for it like @georgecollier said. ![]()
How will this data be used later in the application? Have a custom field data type could get messy as it would likely require a lot of assumptions around how many custom fields of each type a user would want to store since they are hard set in the bubble data type.
For me, using JSON would likely be the most flexible path to actually allow a user to create as many custom fields with different field types as they need without setting some sort of arbitrary limit.
Yeah, there’s a fairly standard pattern for this, and it’s essentially the same in Bubble as in a traditional relational database.
You’d typically have:
-
a custom_field datatype which defines the field details (label, datatype, options, etc.)
-
a custom_field_value datatype which stores the value for a given record (Contact, User, Company, etc.)
Each custom_field_value links:
-
to the record (e.g. Contact)
-
to the custom_field
On the value side, you include fields for each supported datatype (text, number, date, boolean, etc.), and only one is populated depending on the field’s datatype.
This scales naturally — you’re not limited in how many custom fields can be created, since each one is just a new row. Users can create as many custom fields as they like without needing to modify the database structure.
From there it’s just a case of:
-
rendering the correct input based on the field datatype
-
saving to the appropriate value field
-
displaying values accordingly