Re: Testing ajax form behavior still confused me.

2009-09-02 Thread pete swulius
Wicket 1.4.1 resolved my issue.

I still had fun tracing through the wicket code though.  It's pristine in
there.

--pete


Re: Testing ajax form behavior still confused me.

2009-09-02 Thread pete swulius
Ooops, my last statement was not correct.  The correct form values from my
FormTester are posted on the request, but the form processing takes place
for form-2 on the server side.

--pete


Re: Testing ajax form behavior still confused me.

2009-09-02 Thread pete swulius
Okay, I'm on the trail of what is happening, but don't have the full answer
yet.  I doubt this is a defect, but rather a misuse of nested forms & ajax
components on my part.  Though I don't feel like I know enough about wicket
to make the call.

What I know is: the wrong AjaxButton is being selected as the
submittingComponent in Form.findSubmittingButton().

I have the following nesting:

panel-A
  form-1
 AjaxButton (foo)
 panel-B
form-2
AjaxButton (bar)

I'm calling executeAjaxEvent on 'foo', but it is not the first AjaxButton
encountered during my pages visitChildren().  At least in my situation, the
first AjaxButton encountered is 'bar' and it's selected and returned as
submittingComponent.  This seems to cause form-2 to be posted on the
request.

Any thoughts on this would be greatly appreciated!

--pete


Re: Testing ajax form behavior still confused me.

2009-09-02 Thread pete swulius
Thank you for the reply!

On your advice, I took a step back and created a new page, form, and
ajaxbutton.  Creating a FormTester and using executeAjaxEvent(...) does
indeed submit the form through via standard form processing!  However, it's
still not happening on my original page.  I'm looking into why that might be
right now, and I will post my findings when I get to the bottom of it.
Thanks again.  Wicket is awesome.

--pete


Re: Testing ajax form behavior still confused me.

2009-08-31 Thread Martin Makundi
> The simple question I have is, "How do I invoke the behavior associated
> with an AjaxButton as well as the form processing logic, like validation?"

Clicking the button always results in form processing if you hae
defaultFormProcessing=true.

You can click the button via ajax using tester.executeAjaxEvent(xx, "onclick");

> I am using Wicket 1.3.5.

Stop using 1.3.5. 1.4 branch is more robust.

> I have a form that is submitted via an AjaxButton, overriding onSubmit(
> AjaxRequestTarget anAjaxTarget, Form aForm ).  I can easily invoke it's
> behavior by using executeAjaxEvent( path, "onclick" ), but this obviously
> doesn't make use of the FormTester.

call tester.newFormTester(xx) first, and after you have filled the
necessary values, execute the ajax event (instead of calling
formtester.submit).

**
Martin

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



Testing ajax form behavior still confused me.

2009-08-31 Thread pete swulius
Hello everyone!

I have read a lot of forum posts and defects/feature requests around testing
form posts with ajax and am still confused.  The simple question I have is,
"How do I invoke the behavior associated with an AjaxButton as well as the
form processing logic, like validation?"  An even simpler question might be,
"Should I be testing by driving the webapp (Selenium,etc...) instead of
WicketTester for Ajax form posts?

Read on for more details on my struggle...

I am using Wicket 1.3.5.

I have a form that is submitted via an AjaxButton, overriding onSubmit(
AjaxRequestTarget anAjaxTarget, Form aForm ).  I can easily invoke it's
behavior by using executeAjaxEvent( path, "onclick" ), but this obviously
doesn't make use of the FormTester.  I can explicitly set the model object
on each of my TextFields and then call executeAjaxEvent( path "onclick" ),
but this obviously bypasses the form validation logic.  Am I missing
something?  I hope someone out there has been through this already.  I
appreciate all of the help I've gotten so far, so thank you all.

--pete