Skip to content

CMS-55279 Add forms to stride - #506

Merged
TRomesh merged 13 commits into
mainfrom
feature/CMS-55279-add-forms-to-stride
Sep 1, 2026
Merged

CMS-55279 Add forms to stride#506
TRomesh merged 13 commits into
mainfrom
feature/CMS-55279-add-forms-to-stride

Conversation

@TRomesh

@TRomesh TRomesh commented Aug 25, 2026

Copy link
Copy Markdown
Member
  • Add Forms support in content areas.
  • Refactor Forms docs.
  • Add form in Stride template

Copilot AI 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.

Pull request overview

This PR extends the Optimizely CMS JS SDK and included templates to better support Optimizely Forms—particularly when forms are placed in content areas (not only experience compositions)—and improves submission ergonomics via an optional submitHandler. It also updates the Stride and Alloy templates to render forms with consistent styling and improves the Forms documentation.

Changes:

  • Add SDK support to detect and resolve form container steps when forms are referenced via content properties/content areas (including additional Graph fetching where needed).
  • Add submitHandler support to FormWrapper, and expose a safe errorMessage for templates to render on handler failures.
  • Add Forms components + initialization wiring to the Stride template, update Alloy template previews/alerts, and refactor docs/15-forms.md.

Reviewed changes

Copilot reviewed 30 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
templates/stride/lib/initialization.ts Registers Forms components via initForms and passes host for Graph filtering.
templates/stride/components/forms/Grid.tsx Adds row/column wrappers used by the form layout with preview attributes.
templates/stride/components/forms/FormTextarea.tsx Adds Stride textarea field renderer with validation + preview attributes.
templates/stride/components/forms/FormSubmit.tsx Adds Stride submit/step button renderer using useFormButton.
templates/stride/components/forms/formStyles.ts Adds shared Tailwind class utilities for consistent form styling.
templates/stride/components/forms/FormStepTracker.tsx Adds a client-side multi-step progress indicator.
templates/stride/components/forms/FormSelection.tsx Adds Stride selection/radio-group renderer with validation + preview attributes.
templates/stride/components/forms/FormInput.tsx Adds Stride textbox renderer with HTML validation attributes.
templates/stride/components/forms/FormContainer.tsx Adds Stride form container renderer using FormWrapper + step/button partitioning.
templates/stride/components/forms/FormAlerts.tsx Adds success/error alert rendering using useFormSubmission state.
templates/stride/app/api/forms/submit/route.ts Adds a sample Next.js route handler for form submission.
templates/stride/.env.example Documents APPLICATION_HOST for multi-site host filtering.
templates/alloy/src/components/forms/FormTextarea.tsx Adds preview attributes for placeholder/tooltip.
templates/alloy/src/components/forms/FormSelection.tsx Adds preview attributes for tooltip.
templates/alloy/src/components/forms/FormInput.tsx Adds preview attributes for tooltip.
templates/alloy/src/components/forms/FormErrorAlert.tsx Allows displaying a handler-provided error message.
templates/alloy/src/components/forms/FormContainer.tsx Simplifies dev warning copy for empty nodes.
templates/alloy/src/components/forms/FormAlerts.tsx Wires errorMessage from useFormSubmission into the error alert.
packages/optimizely-cms-sdk/src/util/queryUtils.ts Adds content-model-based detection for types that can hold form containers.
packages/optimizely-cms-sdk/src/react/server.tsx Minor formatting change.
packages/optimizely-cms-sdk/src/react/forms/index.ts Exports FormSubmitHandler type.
packages/optimizely-cms-sdk/src/react/forms/FormWrapper.tsx Adds submitHandler support and adjusts submission/error handling.
packages/optimizely-cms-sdk/src/react/forms/FormSubmissionProvider.tsx Stores submit error + exposes errorMessage for templates.
packages/optimizely-cms-sdk/src/react/test/forms.test.tsx Adds tests for submitHandler and error-message behavior.
packages/optimizely-cms-sdk/src/graph/index.ts Resolves unresolved form nodes via extra fetches and content-model detection.
packages/optimizely-cms-sdk/src/graph/createQuery.ts Prevents composition fetching when inside a composition; adjusts section handling.
packages/optimizely-cms-sdk/src/graph/test/sectionRoot.test.ts Adds coverage for section-enabled component in content-area path.
packages/optimizely-cms-sdk/src/graph/test/formsOnPage.test.ts Adds coverage for forms in content areas and model-based detection.
packages/optimizely-cms-sdk/src/graph/test/contentAreaForms.test.ts New test ensuring content-area forms have steps resolved via extra fetch.
docs/15-forms.md Refactors/expands Forms docs, including submission-from-code guidance.
.changeset/olive-moons-repeat.md Declares a minor release with content-area forms + submitHandler changes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/optimizely-cms-sdk/src/graph/index.ts Outdated
Comment thread templates/stride/app/api/forms/submit/route.ts
Comment thread docs/15-forms.md
@TRomesh
TRomesh enabled auto-merge August 28, 2026 12:26

@marin-karamihalev marin-karamihalev 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.

LGTM

@TRomesh
TRomesh force-pushed the feature/CMS-55279-add-forms-to-stride branch from 073c65a to bbb51b8 Compare September 1, 2026 13:33
@TRomesh
TRomesh disabled auto-merge September 1, 2026 13:35
@TRomesh
TRomesh merged commit 021ac09 into main Sep 1, 2026
1 check passed
@TRomesh
TRomesh deleted the feature/CMS-55279-add-forms-to-stride branch September 1, 2026 13:35
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