octobercms/october · error · SystemException

Field [ ] not found in form.

Error message

Field [{$fieldName}] not found in form.

What it means

The onLoadTranslateField AJAX handler received a 'field_name' POST value that does not match any field defined on the form. This is a sentinel guard before opening the per-site translation popup: the field name comes straight from the request and is looked up via getField().

Solutions

  1. Verify the field exists in the form's field configuration and that its name matches the posted field_name
  2. If the field was renamed or removed, update the frontend markup/AJAX payload that sends field_name
  3. Guard the handler and return a friendly validation message instead of letting the exception bubble to the user
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/widgets/form/HasTranslatable.php:29 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/9aeae4a66de806e6. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/widgets/form/HasTranslatable.php:29

 */
trait HasTranslatable
{
    /**
     * @var array translatableSitesCache keyed by filter type ('locale' or 'currency')
     */
    protected $translatableSitesCache = [];

    /**
     * onLoadTranslateField AJAX handler to open the translate popup for a single site
     */
    public function onLoadTranslateField()
    {
        $fieldName = post('field_name');
        $siteId = post('site_id');
        $field = $this->getField($fieldName);

        if (!$field) {
            throw new SystemException("Field [{$fieldName}] not found in form.");
        }

        $site = $this->getTranslatableSite($siteId);

        // Wrap the entire handler in site context so the form widget renders
        // with the correct site (and currency) active
        return Site::withContext($site->id, function () use ($field, $site) {
            $siteModel = $this->getTranslatableSiteModel($this->model, $site);
            $formWidget = $this->makeTranslateFormWidget($field, $siteModel, $site);

            $this->vars['translatableField'] = $field;
            $this->vars['translatableSite'] = $site;
            $this->vars['translatableFormWidget'] = $formWidget;
            $this->vars['translatableSessionKey'] = $formWidget->getSessionKey();
            $this->vars['translatableModelId'] = $this->model->getKey();

            return $this->makePartial('translate_popup');
        });

View on GitHub (pinned to b608633a7e)