Form Factory - Introduction
Why you eventually stop building forms by hand and start generating them
Around the fifteenth form, something changes. You’re not solving a new problem any more - you’re copying the last one, changing the field list, and hoping you didn’t forget the validation.
That’s the point where it’s worth treating form definitions as data rather than as work. Describe the form in configuration, render it from that description, and adding a form becomes a row in a table instead of a deployment.
What “configuration-driven” means
Instead of building each form as its own artefact, you store a definition - the fields, their types, validation rules, conditional logic, layout - and one renderer turns any definition into a working form.
The definition can live in a Dataverse table, in JSON in a web file, or in site settings. Dataverse is usually the right answer on this platform: table permissions control who can read the definitions, auditing is there once you turn it on for the environment, table and columns (it uses log storage capacity), and the editing experience comes with the table.
When it’s worth it
Reach for this when:
- You have a lot of similar forms, or expect to
- Non-developers need to change forms without a release
- Forms need to vary by role, region, or product
- You need the same form on several pages, staying in sync
Don’t bother when:
- You have three forms and they’re all different
- Each form has bespoke logic
- The team maintaining it won’t be comfortable with the indirection
That last one is a real consideration. A form factory concentrates cleverness in one place, and whoever inherits it needs to be able to read that place.
The trade you’re making
You’re swapping many simple things for one complex thing.
Fifteen hand-built forms are fifteen places to change something, but each one is obvious. A form factory is one place to change something, but that place has to handle every case any form might need - and the day someone needs a field type you didn’t anticipate, you’re back in code.
The break-even point is lower than people expect. It’s also easier to reach the wrong way: a factory that grew organically out of one form and now has nine special cases hardcoded in it is worse than either extreme.
What a definition needs to carry
At minimum:
- Fields: name, type, label, whether it’s required
- Validation: rules, and the message shown when they fail
- Layout: grouping, ordering, sections
- Conditional logic: what shows when, based on what
- Behaviour on submit: where the data goes, what happens next
The interesting design decisions are about how much logic the definition can express. Too little and you’re writing exceptions in code; too much and you’ve invented a programming language with no debugger.
Start narrow. Support the field types you have, and add more when a form needs them.
Wrapping up
Configuration-driven forms are a good answer to a specific problem: many similar forms, changing often, edited by people who shouldn’t need a deployment. They’re a bad answer to a handful of bespoke forms.
Be honest about which one you have before you build the machine.
Useful links
- Add a form to a page
- Basic forms reference
- Multistep forms
- Data workspace: tables, forms and views
- Site settings
Next: building it.