SonataAdminBundle
SonataAdminBundle copied to clipboard
function show_form_first_tab_with_errors not triggerd anymore
Environment
Sonata packages
show
$ composer show --latest 'sonata-project/*'
Put the result here.
`sonata-project/admin-bundle 4.34.0 4.36.1 The missing Symfony Admin Generator sonata-project/doctrine-orm-admin-bundle 4.18.0 4.18.0 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/exporter 2.14.0 3.3.1 Lightweight Exporter library sonata-project/translation-bundle 3.3.0 3.3.0 SonataTranslationBundle sonata-project/twig-extensions 2.5.0 2.5.0 Sonata twig extensions sonata-project/user-bundle 5.14.0 5.14.0 Symfony SonataUserBundle
Transitive dependencies not required in composer.json: sonata-project/block-bundle 5.1.2 5.1.2 Symfony SonataBlockBundle sonata-project/doctrine-extensions 2.5.0 2.5.0 Doctrine2 behavioral extensions sonata-project/form-extensions 2.4.1 2.4.1 Symfony form extensions `
Symfony packages
show
$ composer show --latest 'symfony/*'
Put the result here.
test
`` symfony/amqp-messenger 6.4.13 7.2.3 Symfony AMQP extension Messenger Bridge symfony/apache-pack 1.0.1 1.0.1 A pack for Apache support in Symfony symfony/asset 6.4.13 7.2.0 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files symfony/browser-kit 6.4.19 7.2.4 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically symfony/console 6.4.20 7.2.5 Eases the creation of beautiful and testable command line interfaces symfony/css-selector 6.4.13 7.2.0 Converts CSS selectors to XPath expressions symfony/debug-bundle 6.4.13 7.2.0 Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework symfony/dotenv 6.4.16 7.2.0 Registers environment variables from a .env file symfony/expression-language 6.4.13 7.2.0 Provides an engine that can compile and evaluate expressions symfony/flex 2.5.0 2.5.0 Composer plugin for Symfony symfony/form 6.4.20 7.2.5 Allows to easily create, process and reuse HTML forms symfony/framework-bundle 6.4.20 7.2.5 Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/http-client 6.4.19 7.2.4 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/intl 6.4.15 7.2.0 Provides access to the localization data of the ICU library symfony/mailer 6.4.18 7.2.3 Helps sending emails symfony/maker-bundle 1.62.1 1.62.1 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code. symfony/messenger 6.4.19 7.2.5 Helps applications send and receive messages to/from other applications or via message queues symfony/monolog-bundle 3.10.0 3.10.0 Symfony MonologBundle symfony/phpunit-bridge 7.2.0 7.2.0 Provides utilities for PHPUnit, especially user deprecation notices management symfony/process 6.4.20 7.2.5 Executes commands in sub-processes symfony/property-access 6.4.18 7.2.3 Provides functions to read and write from/to an object or array using a simple string notation symfony/property-info 6.4.18 7.2.5 Extracts information about PHP class' properties using metadata of popular sources symfony/requirements-checker 2.0.3 2.0.3 Check Symfony requirements and give recommendations symfony/security-bundle 6.4.13 7.2.3 Provides a tight integration of the Security component into the Symfony full-stack framework symfony/serializer 6.4.19 7.2.5 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON. symfony/stopwatch 6.4.19 7.2.4 Provides a way to profile code symfony/string 6.4.15 7.2.0 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation 6.4.19 7.2.4 Provides tools to internationalize your application symfony/twig-bundle 6.4.13 7.2.0 Provides a tight integration of Twig into the Symfony full-stack framework symfony/validator 6.4.20 7.2.5 Provides tools to validate values symfony/web-link 6.4.13 7.2.0 Manages links between resources symfony/web-profiler-bundle 6.4.19 7.2.4 Provides a development tool that gives detailed information about the execution of any request symfony/webpack-encore-bundle 2.2.0 2.2.0 Integration of your Symfony app with Webpack Encore symfony/workflow 6.4.13 7.2.0 Provides tools for managing a workflow or finite state machine symfony/yaml 6.4.20 7.2.5 Loads and dumps YAML files
Transitive dependencies not required in composer.json: symfony/cache 6.4.20 7.2.5 Provides extended PSR-6, PSR-16 (and tags) implementations symfony/cache-contracts 3.5.1 3.5.1 Generic abstractions related to caching symfony/clock 6.4.13 7.2.0 Decouples applications from the system clock symfony/config 6.4.14 7.2.3 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/dependency-injection 6.4.20 7.2.5 Allows you to standardize and centralize the way objects are constructed in your application symfony/deprecation-contracts 3.5.1 3.5.1 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge 6.4.20 7.2.5 Provides integration for Doctrine with various Symfony components symfony/dom-crawler 6.4.19 7.2.4 Eases DOM navigation for HTML and XML documents symfony/error-handler 6.4.20 7.2.5 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher 6.4.13 7.2.0 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them symfony/event-dispatcher-contracts 3.5.1 3.5.1 Generic abstractions related to dispatching event symfony/filesystem 6.4.13 7.2.0 Provides basic utilities for the filesystem symfony/finder 6.4.17 7.2.2 Finds files and directories via an intuitive fluent interface symfony/http-client-contracts 3.5.2 3.5.2 Generic abstractions related to HTTP clients symfony/http-foundation 6.4.18 7.2.5 Defines an object-oriented layer for the HTTP specification symfony/http-kernel 6.4.20 7.2.5 Provides a structured process for converting a Request into a Response symfony/mime 6.4.19 7.2.4 Allows manipulating MIME messages symfony/monolog-bridge 6.4.13 7.2.0 Provides integration for Monolog with various Symfony components symfony/options-resolver 6.4.16 7.2.0 Provides an improved replacement for the array_replace PHP function symfony/password-hasher 6.4.13 7.2.0 Provides password hashing utilities symfony/polyfill-intl-grapheme 1.31.0 1.31.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu 1.31.0 1.31.0 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-intl-idn 1.31.0 1.31.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer 1.31.0 1.31.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring 1.31.0 1.31.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 1.31.0 1.31.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php80 1.31.0 1.31.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php83 1.31.0 1.31.0 Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions symfony/polyfill-php84 1.31.0 1.31.0 Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions symfony/routing 6.4.18 7.2.3 Maps an HTTP request to a set of configuration variables symfony/security-acl 3.3.4 3.3.4 Symfony Security Component - ACL (Access Control List) symfony/security-core 6.4.18 7.2.3 Symfony Security Component - Core Library symfony/security-csrf 6.4.13 7.2.3 Symfony Security Component - CSRF Library symfony/security-http 6.4.19 7.2.4 Symfony Security Component - HTTP Integration symfony/service-contracts 3.5.1 3.5.1 Generic abstractions related to writing services symfony/translation-contracts 3.5.1 3.5.1 Generic abstractions related to translation symfony/twig-bridge 6.4.20 7.2.5 Provides integration for Twig with various Symfony components symfony/var-dumper 6.4.18 7.2.3 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter 6.4.20 7.2.5 Allows exporting any serializable PHP data structure to plain PHP code `
PHP version
$ php -v
Put the result here.
PHP 8.3.17 (cli) (built: Feb 25 2025 02:23:24) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.17, Copyright (c) Zend Technologies
Subject
We are updating a symfony 5.4 project to 6.4. We upgraded SonataAdminBundle 4.11 to 4.36 but that seemed to have broken something.
When we are creating a model in backend, that has tabs with required fields, we are getting a javacript console error:
An invalid form control with name='' is not focusable
This error is showing in the console when clicking on the create button. And the required input field is left empty.
This is due to the input that is required and inside another (at that moment) invisible tab.
When downgrading to version 4.34, we don't have that problem and is working fine.
The browser is then showing the correct tab and showing an error popup at the required field.
Minimal repository with the bug
Steps to reproduce
We are using this function:
Admin.show_form_first_tab_with_errors = function(form, errorSelector) { Admin.log('[core|show_form_first_tab_with_errors] show first tab with errors', form); var tabs = form.find('.nav-tabs a'); checkTabs(tabs, errorSelector); };
it seems this function is not being triggerd anymore in version 4.36
in version 4.34 it does trigger
Expected results
The browser should go to the correct tab and show an error at the required input field
Actual results
Browser is showing an input field focus error like described above and is doing nothing (model is not being created)
Related to https://github.com/sonata-project/SonataAdminBundle/releases/tag/4.36.0 so it must be one of @onEXHovia JS migration PR.
This method was moved to edit controller, as one of the solutions you can get stimulus controller and call showFirstTabWithErrors method.
const controller = window.sonataApplication.getControllerForElementAndIdentifier(document.querySelector('.sonata-ba-form > form'), 'sonata-edit');
controller.showFirstTabWithErrors(':invalid');
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.