You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by delta <ls...@gmail.com> on 2011/08/11 16:39:38 UTC

CheckGroup updateModel + setrequired (Bug?)

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by delta <ls...@gmail.com>.
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)?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-updateModel-setrequired-Bug-tp3736032p3743260.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by Clint Checketts <ch...@gmail.com>.
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 <ls...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: CheckGroup updateModel + setrequired (Bug?)

Posted by delta <ls...@gmail.com>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by Bruno Borges <br...@gmail.com>.
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 <ls...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: CheckGroup updateModel + setrequired (Bug?)

Posted by delta <ls...@gmail.com>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by Bruno Borges <br...@gmail.com>.
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 <ls...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: CheckGroup updateModel + setrequired (Bug?)

Posted by delta <ls...@gmail.com>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by delta <ls...@gmail.com>.
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.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-updateModel-setrequired-Bug-tp3736032p3736592.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by Igor Vaynberg <ig...@gmail.com>.
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 <ls...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by delta <ls...@gmail.com>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by delta <ls...@gmail.com>.
Yeap, I'm calling ;)

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-updateModel-setrequired-Bug-tp3736032p3736067.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CheckGroup updateModel + setrequired (Bug?)

Posted by Bruno Borges <br...@gmail.com>.
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 <ls...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>