We seem to have a similar problem with a wizard page. We came across the
following code in Check.onComponentTag(..)
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");
It looks like the Check component is checking for the existence of raw
input, but then using the input from the current request (via
getInputAsArray()) to render. Sounds fishy! I figure this could be related?
Thomas
On Wed, May 7, 2008 at 5:27 PM, Steen Larsen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have made a CheckGroup vith a ListView of Check's than works fine, except
> that when it is submitted and I'm on the next page and want to go back
> through a Wicket Button (not the browsers back button), all the checks are
> empty even thouch the model behind still contains the selected obejcts.
> Here
> is the example code of the first page:
>
> public HomePage() {
> Order order = ((WicketSession) (Session.get())).getOrder();
> if (order.getDigitalPackets() == null)
> order.setDigitalPackets(new ArrayList<Product>());
> System.err.println("LIST1 = " + order.getDigitalPackets());
> Form form = new DigitalOrderForm("digitalOrderForm");
> form.setModel(new CompoundPropertyModel(order));
> add(form);
> List<Product> allProducts = new ArrayList<Product>();
> for (int i = 0; i < 10; i++) {
> Product p = new Product();
> p.setProductKey(i + "");
> p.setTotalPrice(new BigDecimal(100 + i));
> p.setProductName("Product" + i);
> allProducts.add(p);
> }
> CheckGroup group = new CheckGroup("digitalPackets");
> form.add(group);
> ListView products = new ListView("products", allProducts) {
> protected void populateItem(ListItem item) {
> item.add(new Check("check",
> item.getModel()).setEscapeModelStrings(false));
> item.add(new Label("productName", new
> PropertyModel(item.getModel(), "productName")));
> item.add(new Label("totalPrice", new
> PropertyModel(item.getModel(), "totalPrice")));
> }
> };
> group.add(products.setReuseItems(true));
> }
>
> class DigitalOrderForm extends Form {
> DigitalOrderForm(String s) {
> super(s);
> }
>
> protected void onSubmit() {
> Order order = (Order) getModelObject();
> System.err.println("LIST2 = " +
> order.getDigitalPackets());
> setResponsePage(PageTwo.class);
> }
> }
>
> The second page is just a back button like this:
>
> public PageTwo() {
> add(new Button("back") {
> public void onSubmit() {
> setResponsePage(HomePage.class);
> }
> });
> }
>
> Anybody knows how to get the selected objects shown when you go back like
> that ?
>
> /Steen
>