You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andrea Selva <se...@gmail.com> on 2010/07/22 08:25:03 UTC
Problem with submitLink outside a form
Hi list, sorry for this repost, but I'cant find an answer to the question
and I don't know if this behaviour is intentional or a bug
I'm new to wicket. I've some problem with a Formteser.submitLink that should
sumbit a form throught a link that stay outside the form. I've played with
the wicket provided test case org.apache.wicket.markup.html.
link.submitLink.FormPage and FormPageTest.
in the FormPage I've changed the definition of somevalue deleting the final
keyword
protected int somevalue = 1;
In the TestCase I changed the testFormAndLinkAreSubmitted as follows, simply
setting a value in the field before the submitLink and then verify in the
model the correctness of the value. but fails, as if the submitLink doesn't
post the data.
public void testFormAndLinkAreSubmitted()
{
WicketTester tester = new WicketTester();
tester.startPage(FormPage.class);
FormPage page = (FormPage)tester.getLastRenderedPage();
Assert.assertFalse(page.isSubmitLinkSubmitted());
Assert.assertFalse(page.isFormSubmitted());
FormTester formTester = tester.newFormTester("form");
formTester.setValue("field", "2");
formTester.submitLink("link", true);
page = (FormPage)tester.getLastRenderedPage();
Assert.assertTrue(page.isFormSubmitted());
Assert.assertTrue(page.isSubmitLinkSubmitted());
tester.assertModelValue("form:field", 2);
}
It's a bug or a mine misunderstanding?Somebody could help me, please?
Many thanks in advance
Andrea Selva