| Bundle Version | "sulu/form-bundle": "^2.5",
| Sulu Version | "sulu/sulu": "~2.5.10",
| Browser Version | Google Chrome Version 114.0.5735.198 (Official Build) (64-bit)
Actual Behavior
Submitting the Form results in an error:
Sulu\Bundle\FormBundle\Form\Builder::createForm(): Argument #6 ($webspaceKey) must be of type string, null given, called in /home/reneberndt/sulutest/theatertotal/vendor/sulu/form-bundle/Form/Builder.php on line 182
Expected Behavior
I would either expect it to work, or the submit functionality to be disabled.
Steps to Reproduce
With the given versions, create a Form and load it into a page, then on the admin panel preview try to fill in the form and submit it.
Possible Solutions
The issue is called by the initial value of the variable $webspaceKey being null, while the return type is a string.
Since in the preview, no webspace key is sent on the submission of the form the null value is returned.
(Data available at submit - reproducible by placing dump($request->get('_sulu'));die; at Sulu\Bundle\FormBundle\Form\Builder line 277 after filling in the form fields and before submitting)
If the initial value of $webspaceKey at Sulu\Bundle\FormBundle\Form\Builder line 276 is set to an empty string you can effectively eliminate the error.
| Bundle Version | "sulu/form-bundle": "^2.5", | Sulu Version | "sulu/sulu": "~2.5.10", | Browser Version | Google Chrome Version 114.0.5735.198 (Official Build) (64-bit)
Actual Behavior
Submitting the Form results in an error: Sulu\Bundle\FormBundle\Form\Builder::createForm(): Argument #6 ($webspaceKey) must be of type string, null given, called in /home/reneberndt/sulutest/theatertotal/vendor/sulu/form-bundle/Form/Builder.php on line 182
Expected Behavior
I would either expect it to work, or the submit functionality to be disabled.
Steps to Reproduce
With the given versions, create a Form and load it into a page, then on the admin panel preview try to fill in the form and submit it.
Possible Solutions
The issue is called by the initial value of the variable $webspaceKey being null, while the return type is a string. Since in the preview, no webspace key is sent on the submission of the form the null value is returned. (Data available at submit - reproducible by placing dump($request->get('_sulu'));die; at Sulu\Bundle\FormBundle\Form\Builder line 277 after filling in the form fields and before submitting)
[Builder.php](http://localhost:8000/admin/_profiler/open?file=vendor/sulu/form-bundle/Form/Builder.php&line=277#line277) on line 277: [Sulu\Component\Webspace\Analyzer\Attributes\RequestAttributes](http://localhost:8000/admin/_profiler/open?file=vendor/sulu/sulu/src/Sulu/Component/Webspace/Analyzer/Attributes/RequestAttributes.php&line=17#line17) {#2053 ▼ -attributes: array:4 [▼ "locale" => "de" "localization" => [Sulu\Component\Localization\Localization](http://localhost:8000/admin/_profiler/open?file=vendor/sulu/sulu/src/Sulu/Component/Localization/Localization.php&line=21#line21) {#2051 ▶} "scheme" => "http" "requestUri" => "/admin/preview/render?webspaceKey=example&provider=pages&id=5a08f518-97a8-4b01-b7b1-a11eca0ae116&locale=de&token=fa90c92e0874388520c9579c630326e7&targetGroupId= ▶" ] }
If the initial value of $webspaceKey at Sulu\Bundle\FormBundle\Form\Builder line 276 is set to an empty string you can effectively eliminate the error.
If wanted I can create a pull request for this.