Form Generator ยท Architecture
Architecture
FormGenerator stays slim: core owns shared field types. Feature modules own specialised question components
and pass a small questionRenderers map when creating the form.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Page (YouthStarterOffer, PlayerDetails, โฆ) โ
โ new FormGenerator(el, { โ
โ questions, โ
โ questionRenderers: householdQuestionRenderers โ
โ }) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FormGenerator โ
โ this.questionRenderers = { โ
โ ...coreQuestionRenderers, โ shared types โ
โ ...config.questionRenderers โ module overrides โ
โ } โ
โ renderQuestion() โ registry[questionType](โฆ) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
RadioComponent SchoolFinder HouseHoldMemberList
(core) (core) (Household module)
| Piece | Path | Role |
|---|---|---|
FormGenerator |
components/FormGenerator/index.js |
Orchestration, steps, validation, answers |
QuestionTypes / FormTypes |
components/FormGenerator/questionTypes.js |
Shared type string constants |
coreQuestionRenderers |
components/FormGenerator/questionRenderers.js |
Map of core questionType โ component factory |
| Household renderers | pages/HouseholdAccounts/formQuestions/ |
Module types + components kept with Household |
Form types
| Type | Constant | Behaviour |
|---|---|---|
| Step form | FormTypes.StepForm |
One step visible at a time; final step submits |
| Section form | FormTypes.SectionForm |
All sections on one page; submit visibility controlled by config |