Skip to content

DF-944: Implement TrackingField component - #470

Merged
davidjamesstone merged 3 commits into
mainfrom
feature/DF-944-tracking-field
Sep 10, 2026
Merged

davidjamesstone merged 3 commits into
mainfrom
feature/DF-944-tracking-field

Conversation

@davidjamesstone

@davidjamesstone davidjamesstone commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Proposed change

Adds new component TrackingField.

Renders a hidden <input> with a value of true that can be used to track progress through a form

Dependent on forms-model bump here

Jira ticket: https://eaflood.atlassian.net/browse/DF-994

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Misc. (documentation, build updates, etc)

Checklist

  • You have executed this code locally and it performs as expected.
  • You have added tests to verify your code works.
  • You have added code comments and JSDoc, where appropriate.
  • There is no commented-out code.
  • You have added developer docs in README.md and docs/* (where appropriate, e.g. new features).
  • The tests are passing (npm run test).
  • The linting checks are passing (npm run lint).
  • The code has been formatted (npm run format).

"Hidden fields can be pre-populated from query string parameters — see [Pre-populating state](../code-based/pre-populate-state.md) for details."
],
"TrackingField": [
"Tracking fields can track the user's progress through the form. They are hidden fields that are set to `true` when the user reaches a certain point in the form."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'...when the user reaches a certain point in the form...' - suggest '...when the user reaches the page the tracking field is on..'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I nearly went with this but then reverted. It's only once the user passes then page (through a POST) that it's set to true (i.e. not on the GET).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about 'They are hidden fields that are set to true when the user passes the page in the form.'

*/
static getAllPossibleErrors(): ErrorMessageTemplateList {
return {
baseErrors: [{ type: 'required', template: messageTemplate.required }],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we have any errors for this field? It will always be there so we'll never hit a 'required' error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess they could if they were to delete the hidden input but no ordinarily there couldn't be an error.
I was basing this component on the existing HiddenField which does also have the 1 base required error - is that incorrect for that field then too do you think?

@jbarnsley10 jbarnsley10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor comments

@sonarqubecloud

Copy link
Copy Markdown

@davidjamesstone
davidjamesstone merged commit b321047 into main Sep 10, 2026
23 checks passed
@davidjamesstone
davidjamesstone deleted the feature/DF-944-tracking-field branch September 10, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants