You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Leangen <wi...@leangen.net> on 2008/07/01 05:09:46 UTC

Wizard and CheckGroup

Hello.

I'm using a CheckGroup in a Wizard.

Let's say the CheckGroup is in step 2 of my Wizard:

 [1] <-> [2] <-> [3]

Going through the Wizard, during step 2, I check all the checkboxes,
then I go to step 3.

If I back up to step 2, everything remains checked.

However, if I back up again to step 1, then click next to step 2, I lose
all my checkmarks.


In the code for Check, whether or not the checkbox is checked is
determined by this:

  if (group.hasRawInput())
  {
    final String[] input = group.getInputAsArray();

    if (input != null)
    {
      for (int i = 0; i < input.length; i++)
      {
        if (uuid.equals(input[i]))
        {
          tag.put("checked", "checked");
        }
      }
    }
  }
  else if (collection.contains(getModelObject()))
  {
    tag.put("checked", "checked");
  }


When group.hasRawInput() returns false, and we fall through to the else
clause, everything works as expected.

However, when group.hasRawInput() returns true, on the next line
group.getInputAsArray() returns null. This means that the for condition
never gets executed, so my checkboxes don't get checked.

What's the story with hasRawInput()?


Thanks!
David





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


Re: Wizard and CheckGroup

Posted by Thomas Mäder <to...@gmail.com>.
Why would there be raw input for the Checkbbox on page 2 when stepping
from 1 to 2? What is happening is that the checkbox is populated from
the underlying model, which happens to come up unchecked. What you
should check is: why isnt's the model updated when you first step from
2 to 3? Are you looking at the same model instance?

Thomas

1) when you go from page 2 to three, the values in t

On Tue, Jul 1, 2008 at 5:09 AM, David Leangen <wi...@leangen.net> wrote:
>
> Hello.
>
> I'm using a CheckGroup in a Wizard.
>
> Let's say the CheckGroup is in step 2 of my Wizard:
>
>  [1] <-> [2] <-> [3]
>
> Going through the Wizard, during step 2, I check all the checkboxes,
> then I go to step 3.
>
> If I back up to step 2, everything remains checked.
>
> However, if I back up again to step 1, then click next to step 2, I lose
> all my checkmarks.
>
>
> In the code for Check, whether or not the checkbox is checked is
> determined by this:
>
>  if (group.hasRawInput())
>  {
>    final String[] input = group.getInputAsArray();
>
>    if (input != null)
>    {
>      for (int i = 0; i < input.length; i++)
>      {
>        if (uuid.equals(input[i]))
>        {
>          tag.put("checked", "checked");
>        }
>      }
>    }
>  }
>  else if (collection.contains(getModelObject()))
>  {
>    tag.put("checked", "checked");
>  }
>
>
> When group.hasRawInput() returns false, and we fall through to the else
> clause, everything works as expected.
>
> However, when group.hasRawInput() returns true, on the next line
> group.getInputAsArray() returns null. This means that the for condition
> never gets executed, so my checkboxes don't get checked.
>
> What's the story with hasRawInput()?
>
>
> Thanks!
> David
>
>
>
>
>
> ---------------------------------------------------------------------
> 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