You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anna Simbirtsev <as...@gmail.com> on 2010/04/09 17:46:47 UTC

FormTester with dynamic fields

Hi,

I have the following MarkupContainer:

       final MarkupContainer panel = new WebMarkupContainer("panel");
       panel.setOutputMarkupId(true);

        form.add(panel);

        ArrayList<Contact> rows = new ArrayList<Contact>(1);
        rows.add(new Contact());

        final ListView<Contact> lv = new ListView<Contact>("rows", rows) {

            private static final long serialVersionUID = 1L;

            @Override
            protected void populateItem(ListItem<Contact> item) {
                 Contact c = new Contact();

                 TextField<Contact> text = new TextField<Contact>("field",
new PropertyModel<Contact>(c, "id"));

                 item.add(text);
            }
        };
        lv.setReuseItems(true);
        panel.add(lv);

There is also an ADD MORE button, that adds more of those on the page.


                    <div wicket:id="panel">
                       <span wicket:id="rows">
                          <input wicket:id="field" name="large" type="text"
/>
                       </span>
                    </div>

I using FormTester to test the page:
FormTester formTester = getWicketTester().newFormTester("myForm");

formTester.setValue("field", "BLAH");

But that does not work.

Thanks,
Anna

Re: FormTester with dynamic fields

Posted by Kent Tong <ke...@cpttm.org.mo>.

Anna Simbirtsev wrote:
> 
> There is also an ADD MORE button, that adds more of those on the page.
> ...
> But that does not work.
> 

If it is an AjaxButton, then WicketTester will not execute the Javascript.
To test the
effects as seen in the browser, you may try
http://wicketpagetest.sourceforge.net.


-----
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: http://old.nabble.com/FormTester-with-dynamic-fields-tp28193951p28207809.html
Sent from the Wicket - User 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