You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (Jira)" <ji...@apache.org> on 2020/08/09 07:09:00 UTC

[jira] [Resolved] (WICKET-6811) StatelessForm Button onSubmit premature

     [ https://issues.apache.org/jira/browse/WICKET-6811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier resolved WICKET-6811.
--------------------------------
      Assignee: Sven Meier
    Resolution: Invalid

This is expected, since pages are not rendered before any action is performed on them.

For stateless pages this is a known limitation , i.e. you cannot rely on repeaters to populate their children.

You have to build your component hierarchy independent of rendering, e.g. by adding children in #onInitialize() instead.

> StatelessForm Button onSubmit premature
> ---------------------------------------
>
>                 Key: WICKET-6811
>                 URL: https://issues.apache.org/jira/browse/WICKET-6811
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 8.9.0
>         Environment: Windows, java version "1.8.0_201"
>            Reporter: Bernard
>            Assignee: Sven Meier
>            Priority: Major
>         Attachments: StatelessSubmitPremature.zip
>
>
> A StatelessForm contains a DataView repeater containing CheckBox form fields. The StatelessForm also has a Button outside the repeater that submits the StatelessForm with the objective to extract the CheckBox values. Then the page should be displayed with the new Dataview content. The page is stateless.
> The attached test case shows that onSubmit() is called before the DataView's populateItem() method. This means that onSubmit() cannot find the CheckBox form components in the form's component hierarchy, leading to failure.
> In a successful variation of the test case, enabled by a boolean switch STATELESS_DELAY_ACTION = false, the form's action is done by a Runnable onSubmitRunner which is run later in the StatelessForm's onBeforeRender() method. That Runnable calls the StatelessForm's onFormSubmitted(null) which is NOT part of the public API.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)