Hi *,

i have a courious situation here. My TestHomePanel is running green, but in 
browser the label is not updated. If i remove the css-class from the choices it 
works as expected. It seems that the lookup of the radios in the group is not 
working. But i don't find the place in code to check.

Is someone seeing the cause or knows where the radios in the group will be 
handled?

Cheers
Per

HomePanel.java
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.Radio;
import org.apache.wicket.markup.html.form.RadioGroup;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

public class HomePanel extends Panel {

  public HomePanel(String id) {
    super(id);

    Form<Void> f = new Form<Void>("form");
    add(f);

    IModel<Byte> groupModel = new Model<Byte>(Byte.valueOf("1"));

    final RadioGroup<Byte> g = new RadioGroup<Byte>("rgroup", groupModel);
    f.add(g);
    g.add(new AjaxFormChoiceComponentUpdatingBehavior() {
      @Override
      protected void onUpdate(AjaxRequestTarget target) {
        target.addComponent(HomePanel.this);
      }
    });
    g.add(new Radio<Byte>("r1", new Model<Byte>(Byte.valueOf("1"))));
    g.add(new Radio<Byte>("r2", new Model<Byte>(Byte.valueOf("2"))));

    Label l = new Label("result", groupModel);
    f.add(l);
  }
}

HomePanel.html
<html xmlns:wicket>
<wicket:panel>
        <form wicket:id="form">
          <span wicket:id="result">[Text]</span>
          <span wicket:id="rgroup">
                <input type="radio" wicket:id="r1" class="abc">
                <input type="radio" wicket:id="r2" class="abc">
          </span>
        </form>
</wicket:panel>
</html>

TestHomePanel.java
import junit.framework.TestCase;

import org.apache.wicket.util.tester.FormTester;
import org.apache.wicket.util.tester.WicketTester;

/**
 * Simple test using the WicketTester
 */
public class TestHomePanel extends TestCase
{
  private WicketTester tester;
        
  @Override
  public void setUp()
  {
    tester = new WicketTester(new WicketApplication());
  }
        
  public void testWorks() {
    tester.startPanel(HomePanel.class);
    assertChangedLabelOnClick();
  }

  private void assertChangedLabelOnClick() {
    tester.assertLabel("panel:form:result", "1");
    FormTester f = tester.newFormTester("panel:form");
    f.select("rgroup", 1);
    f.submit();
    tester.assertLabel("panel:form:result", "2");
  }
}
-- 
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/chbrowser

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

Reply via email to