Skip to main content

Field View-Type Override (Admin vs Config)

Define how fields behave and render across different component views โ€” all from a single definition.

What Is Field View-Type Override?

In JCB, each field can be customized to behave differently depending on the context in which itโ€™s used. Most commonly, this means distinguishing how the same field should appear or function in:

  • The Admin (backend) interface
  • The Configuration view (e.g. component options)
  • The Site (frontend) interface

Rather than duplicating fields, JCB allows you to override key properties per view type. This includes rendering, default values, required flags, visibility, layout styling, and even custom logic. It ensures your fields stay DRY (Don't Repeat Yourself) while still adapting intelligently to their environment.

Key Features

  • ๐ŸŽญ Contextual Overrides: Define different behavior for:
    • Admin view (e.g., edit form, list view)
    • Site view (public-facing form or display)
    • Config view (component/system settings)
  • ๐Ÿง  View-Specific Logic: Control:
    • Field type (text, textarea, radio, etc.)
    • Default or fallback values
    • Show/hide status
    • Validation rules
    • Layout and CSS classes
    • Read-only or editable modes
  • ๐Ÿ”„ Shared Data Model: All overrides use the same base field โ€” ensuring consistent DB schema.
  • ๐Ÿ’ก Integrated With Custom Scripting: Combine per-view overrides with conditional logic for maximum flexibility.
  • ๐Ÿ“ฆ Compile-Time Aware: JCB generates separate render logic for each view type during compile.

Use Cases

  • Show a select field in the admin, but a readonly label in the config view.
  • Disable a field in the site view but keep it editable in the backend.
  • Apply different validation or placeholder text depending on the view.
  • Use a rich editor in the admin, but plain input on the frontend.

How to Use It

  1. Open the Admin View in JCB.
  2. Edit the Field Relations and Field Conditions in the Admin view.
  3. Add the wanted field conitions and relations to the fields based on that admin view.
  4. Set field Realationships for:
    • Field to a Database Table
    • Custom Join Code
  5. Define Conditions such as:
    • Field Toggle
    • Match and Match Behavior
    • Target Fields
  6. Save and compile your component.

๐Ÿง  Tip: Use this feature to consolidate complex logic into a single field definition and reduce duplication across views.

Conclusion

Field View-Type Overrides are an elegant way to customize the user experience across multiple contexts while keeping your blueprint clean and maintainable. They allow each field to adapt without redundancy โ€” ensuring the right UX for admins, users, and system settings alike.