A well-organized form that uses subforms to group related fields together. You'll create a user registration form with contact information, address details, and nested subforms for better organization.
Every code snippet below is fully editable! Feel free to modify the code, experiment with different values, and see your changes reflected instantly in the live preview on the right.
Use the play button to run different snippet, or the refresh button to restore the original example.
Let's start with an empty form function. This is where we'll build our subform-organized form step by step.
Let's add a basic subform to organize contact information. Subforms help group related fields together for better organization.
form.addSubform() to create a subform. The returned subform object has the same methods as the main form, so you can add rows and fields to it! Now let's add another subform for address information. Multiple subforms help organize complex forms into logical sections.
Finally, let's create a nested subform within the address subform. This demonstrates how subforms can contain other subforms for complex organization.
addSubform() on any subform to create nested subforms. This is perfect for organizing complex forms with multiple levels of grouping! Sticky subforms stay visible at the edge of the screen as you scroll, perfect for order summaries or totals that users need to see while filling out a long form.
sticky: 'bottom' to pin a subform to the bottom of the viewport. When users scroll down to its natural position, it "unsticks" and becomes part of the normal flow. You can also use sticky: 'top' for headers! Excellent! You've learned how to organize forms using subforms. Ready to explore more advanced form organization techniques?
Continue to Computed Values TutorialOther learning paths: