[
https://issues.apache.org/jira/browse/WICKET-7141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17916676#comment-17916676
]
Florian Lacreuse commented on WICKET-7141:
------------------------------------------
Hi,
Thank you for the quick reply.
??But the patch as is calls the new hook method only in the parent form. I'm
afraid of adding a new point in the form lifecycle and keep it out of the loop
depending if the form is the parent one or not. Sounds like recipe for future
tickets like "the form was submitted but the method x wasn't called".??
You're absolutely right but that's already the case with the
{{Form#beforeUpdateFormComponentModels()}}, is-it right? But I agree, 2 methods
like that mean twice as many potential problems.
??But if we proceed by calling Form#afterUpdateFormComponentModels in nested
forms, the calls would be done in postorder, which is the natural one since the
form contains the most detailed data in the tree leaves and composed ones
closer to the root, which would bring your original problem back if I
understood you right.??
It might still work. With a pattern like
{{Form#internalOnValidateModelObjects()}}?
* {{Form#internalOnAfterUpdateFormComponentModels()}} (with nested forms post
order visit)
* {{Form#onAfterUpdateFormComponentModels()}} to override if necessary in root
form or any nested forms.
(Same thing with before for symmetry.)
Thus actions can be done in the root form with updated models but before the
{{Form#onValidateModelObjects()}} calls.
This will brake the current API.
> Add hook method afterUpdateFormComponentModels() in Form process
> ----------------------------------------------------------------
>
> Key: WICKET-7141
> URL: https://issues.apache.org/jira/browse/WICKET-7141
> Project: Wicket
> Issue Type: Improvement
> Components: wicket-core
> Affects Versions: 10.3.0
> Reporter: Florian Lacreuse
> Priority: Minor
> Labels: form
> Attachments: form-process-hook.patch
>
>
> In my team, we need to be able to do specific actions once the update form
> component models phase is complete, at the parent form level.
> The process form algorithm provides a hook method
> {{beforeUpdateFormComponentModels()}} but it's way too early.
> Until Wicket 10.2.0 (included), we get around the problem by overriding the
> {{onValidateModelObjects()}} from the parent form.
> However since Wicket 10.3.0 and WICKET-3899, this small hack no longer works
> due to new postorder processing (nested forms come first).
> Anyway, we think this "after" hook method can be useful for many reasons,
> just like the "before" one.
> What do you think?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)