You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Kamil (JIRA)" <ji...@apache.org> on 2017/12/22 12:53:00 UTC

[jira] [Commented] (WICKET-6392) Can not change Model when form has Validation Errors

    [ https://issues.apache.org/jira/browse/WICKET-6392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16301342#comment-16301342 ] 

Kamil commented on WICKET-6392:
-------------------------------

[~mgrigorov] It occurred, that even you (a mean as Wicket developer) can make a mistake with this.
You suggested in your [comment|https://issues.apache.org/jira/browse/WICKET-6392?focusedCommentId=16036694&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16036694] using 
{code}
FeedbackCollector(form).collect().stream().forEach(fm -> fm.setRendered(true))
{code}
so I used it.
After months it occurred, that we have a bug in production, because FeedbackCollector(form) by default takes Session into account as well.
So please think of it: if even you can do it wrong - what about regular users?
That is why I think that "clearForm" method is still relevant.

> Can not change Model when form has Validation Errors
> ----------------------------------------------------
>
>                 Key: WICKET-6392
>                 URL: https://issues.apache.org/jira/browse/WICKET-6392
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 8.0.0-M6
>            Reporter: Kamil
>            Assignee: Martin Grigorov
>         Attachments: wicket-showcase-cleanForm.zip
>
>
> I have a Modal with Form and Submit button (it is used for creating new users).
> Form has several text fields bound to CompoundPropertyModel.
> Everytime I open the Modal, I set  the ModelObject as new User();
> It works fine (fields "see" new model if I cancel the window or if I sumbit it without erors).
> If Form has validation errors, even if i set compoundModel.setObject(new User()); fields have old value and validation erros are present.
> I found [workaround|https://stackoverflow.com/questions/8879775/apache-wicket-how-to-update-model-after-validation-error] but I believe it should be possible with Wicket without "workarounds"



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)