Portal Community

What FormPlayerPage Handles

Props

interface FormPlayerPageProps {
  formId:          number;                   // ID of the form to load
  recordId?:       string | number;          // For edit/view — loads existing record
  mode?:           FormMode;                 // Default: "edit"
  breadcrumbs?:    BreadcrumbItem[];
  onSubmitSuccess?: (values: any) => void;   // Called after successful submit
  redirectOnSubmit?: string;                  // URL to navigate to after submit
  className?:      string;
  context?:        Record<string, any>;      // Extra $context values
}

Usage — New Record (Create Form)

import { FormPlayerPage } from '@atlas-forms/pages-player-react';

const CreateCustomerPage: React.FC = () => (
  <FormPlayerPage
    formId={12001}
    mode="edit"
    breadcrumbs={[
      { label: 'Home', href: '/' },
      { label: 'Customers', href: '/customers' },
      { label: 'New Customer' }
    ]}
    redirectOnSubmit="/customers"
  />
);

Usage — Existing Record (Edit Form)

import { FormPlayerPage } from '@atlas-forms/pages-player-react';
import { useParams }      from 'react-router-dom';

const EditCustomerPage: React.FC = () => {
  const { customerId } = useParams();
  return (
    <FormPlayerPage
      formId={12001}
      recordId={customerId}
      mode="edit"
      breadcrumbs={[
        { label: 'Customers', href: '/customers' },
        { label: 'Edit Customer' }
      ]}
      redirectOnSubmit="/customers"
    />
  );
};

Usage — View Mode (Record Detail)

import { FormPlayerPage } from '@atlas-forms/pages-player-react';

const CustomerDetailPage: React.FC<{ id: string }> = ({ id }) => (
  <FormPlayerPage
    formId={12001}
    recordId={id}
    mode="view"
    breadcrumbs={[
      { label: 'Customers', href: '/customers' },
      { label: 'Customer Details' }
    ]}
  />
);

Error Handling

The built-in error boundary catches three types of failures and shows appropriate UI:

FailureUI Shown
Form not found (API 404)"Form not found" message with back link
Record not found (API 404)"Record not found" message with back link
Network error"Unable to load form" with retry button
Render error (React error boundary)"Something went wrong" with reload button and error details in dev mode