CheckGroup updateModel + setrequired (Bug?)

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

CheckGroup updateModel + setrequired (Bug?)

delta
When I set the setRequired(true) in a CheckGroup and Override the onValidate of the Form, calling updateFormComponentModels(); to update the Models, a NullPointerException occurs in CheckGroup.updateModel.

This only occurs when setRequired is setted to true, not happening when not setted or when explicitly setted to false.
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

Bruno Borges
Are you calling super.onValidate() ?

And I think before updating the models, all components must be visitted.


*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Thu, Aug 11, 2011 at 11:39 AM, delta <[hidden email]> wrote:

> When I set the *setRequired(true)* in a CheckGroup and Override the
> *onValidate* of the Form, calling *updateFormComponentModels();* to update
> the Models, a NullPointerException occurs in CheckGroup.updateModel.
>
> This only occurs when setRequired is setted to true, not happening when not
> setted or when explicitly setted to false.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/CheckGroup-updateModel-setrequired-Bug-tp3736032p3736032.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

delta
This post was updated on .
Yeap, I'm calling ;)

And as far as I know, the onValidate() of the super, visit the components in the Form.
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

delta
Hmmm, the error only occurs when no CheckBox in the CheckGroup is marked, but considering this scenario the super.onValidate() should complain about I don't have any CheckBox marked in a CheckGroup with serRequired(true), that's not what happening. And since this validation don't exists, when CheckGroup.updateModel is called I receive a NullPointerException.
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

Bruno Borges
Is that Wicket 1.5 RC5.1 ?

*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Thu, Aug 11, 2011 at 12:00 PM, delta <[hidden email]> wrote:

> Hmmm, the error only occurs when no CheckBox in the CheckGroup is marked,
> but
> considering this scenario the super.onValidate() should complain about I
> don't have any CheckBox marked in a CheckGroup with serRequired(true),
> that's not what happening. And since this validation don't exists, when
> CheckGroup.updateModel is called I receive a NullPointerException.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/CheckGroup-updateModel-setrequired-Bug-tp3736032p3736099.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

delta
It's 1.4.15
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

Bruno Borges
Could you test your app with 1.4.18 ?

Just in case...

*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Thu, Aug 11, 2011 at 12:04 PM, delta <[hidden email]> wrote:

> It's 1.4.15
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/CheckGroup-updateModel-setrequired-Bug-tp3736032p3736109.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

Igor Vaynberg-2
In reply to this post by delta
why are you calling updatemodels() from inside onvalidate()? this is
what happens anyways if validation passes. i am guessing your code
does not check if the form is valid before calling updatemodels()
which causes the error you are describing since you are forcing a
model update for a component that is in an invalid state.

-igor


On Thu, Aug 11, 2011 at 7:59 AM, delta <[hidden email]> wrote:

> Hmmm, the error only occurs when no CheckBox in the CheckGroup is marked, but
> considering this scenario the super.onValidate() should complain about I
> don't have any CheckBox marked in a CheckGroup with serRequired(true),
> that's not what happening. And since this validation don't exists, when
> CheckGroup.updateModel is called I receive a NullPointerException.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-updateModel-setrequired-Bug-tp3736032p3736096.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

delta
I'm doing that to force the Models to update, since when I receive a validate error, like when I dont fill a required field, the checkgroup in the page loose the ckeckboxes marked, so I update the models and the marked checkboxes come back (So the user dont have to mark all over again just because of a field he forgot to fill).

Why the component is in a invalid state? It's in a invalid state because of the setRequired(true)? The error only happens in this scenario, like I said before.

I tried the hasError():
                if (!hasError()) {
                        updateFormComponentModels();
                }

It returns true when I don't mark any checkbox in the checkgroups (ok), but since the updateFormComponentModels() will only be called if no error occurs, I will loose the marked checkboxes.
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

delta
In reply to this post by Bruno Borges
I can't, we must work with this version, because of the company.
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

Clint Checketts
Even if you can't upgrade the production version its worth testing it
against the newer version of Wicket to see if the bug is resolved.

On Thu, Aug 11, 2011 at 12:43 PM, delta <[hidden email]> wrote:

> I can't, we must work with this version, because of the company.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/CheckGroup-updateModel-setrequired-Bug-tp3736032p3736594.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: CheckGroup updateModel + setrequired (Bug?)

delta
It will get some time to test that, but i will give a try later.
What a want to understand is:
1) Why the checkgroup dont update his model automatically, forcing me to call updateFormComponentModels()??
I tried a PropertyModel in the constructor and a collection directly, the result is the same.
2) Why the updateFormComponentModels() have this strange behavior with CheckGroup + setRequired(true)?