Working with Data Fields in bookingforms (Advanced JSON Storage)
This pattern is ideal for storing window lists, products, installation items, service lines, or any structured customer data.
On this page
Jump to any section using the links below
Working with Hubhus Data Fields
Table of Contents
- 1. Declaring a Hubhus Data Field
- 2. Storing JSON Data with JavaScript
- 3. Save Function with Error Handling
- 4. Auto-Save Pattern (Recommended)
- 5. Saving Additional Calculated Fields
- 6. Best Practices for Data Structures
- 7. Accessing the Data in Emails or Templates
- 8. Full data field example
- Summary
Hubhus Data Fields allow you to store complex, structured JSON data inside a lead or booking — ideal for storing lists of windows, product lines, rooms, measurements, or any nested information that doesn't fit in a single field.
This article shows how to declare data fields, store structured JSON, auto-save changes, and use the data in Hubhus templates.
1. Declaring a Hubhus Data Field
Parameters
slug — the API name of the data field (must match your Hubhus configuration)
required — optional; forces the field to contain a value before submission
This produces a hidden input:
2. Storing JSON Data with JavaScript
Here is a real-world example representing windows that a customer wants installed or replaced.
Key rules:
✔ Use JSON.stringify()
✔ Save with jQuery: jQuery('#df_windows').val()
✔ The ID equals your slug (df_windows)
3. Save Function with Error Handling
4. Auto-Save Pattern (Recommended)
Ensures you don’t lose changes:
5. Saving Additional Calculated Fields
Example: Save the total price of all windows into a normal Hubhus field.
Hidden field:
JavaScript calculation:
Now this total is available for emails, automations, summaries, etc.
6. Best Practices for Data Structures
✔ Do:
Use clear names:
model,room,color,priceAdd unique IDs for each item
Validate data before saving
Handle JSON parsing errors
Store any calculated values explicitly (like total price)
❌ Don’t:
Store HTML, DOM elements, or functions
Expect circular references to stringify
Assume jQuery is ready immediately
Forget to re-save when your UI changes
7. Accessing the Data in Emails or Templates
Hubhus exposes JSON items as iterable arrays.
Example:
Supports:
Tables
Summaries
Installation plans
Offer or order overviews
8. Full data field example
Use this as a ready-to-adapt boilerplate.
Summary
| Step | Description |
|---|---|
| Declare | <hh-data-fields.raw-input slug="df_windows"> |
| Save | jQuery('#df_windows').val(JSON.stringify(windows)) |
| Update | Call your save function whenever items change |
| Auto-save | Use setInterval for extra safety |
| Access | Use @foreach in templates and emails |
This pattern is ideal for storing window lists, products, installation items, service lines, or any structured customer data.
? Common searches
booking setup • calendar setup • appointment scheduling • booking configuration
? Also known as
appointment • scheduling • reservation • calendar event
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article