AjaxButton has AjaxFormSubmitBehavior which is AjaxEventBehavior
It should be able to find it

On Fri, May 27, 2011 at 10:17 AM, Mathilde Pellerin
<mathilde.pelle...@gmail.com> wrote:
> no, it doesn't work. I have this error :
> org.apache.wicket.WicketRuntimeException: No AjaxEventBehavior found on
> component: ajaxSubmitLogin which matches the event: onClick
>
> And it is true that I have not add AjaxEventBehavior to my AjaxButton : I
> just override the onSubmit method of my Ajax Button.
>
> 2011/5/26 Per Newgro <per.new...@gmx.ch>
>
>> As far as i understood this, FormTester submit is only for pushing the data
>> from
>> component to model. If you wait for the component to be executed the js
>> event
>> has to be executed.
>>
>> Is it working if you do an WicketTester.executeAjaxEvent("id", "onclick");
>> ?
>>
>> Cheers
>> Per
>>
>>
>>  Hi all,
>>>
>>> I am testing a form with FormTester and WicketTester.
>>> When I test error messages which are send by form validation, test works
>>> well :
>>> tester.assertErrorMessages(new String[] {"Le champ 'Identifiant' est
>>> obligatoire."});
>>>
>>> but when I test error message which is send by my submit ajaxButton, test
>>> fail : no error is sent.
>>> When I test application manually, this error appears in feedBackPanel.
>>> I don't understand why error is not sent when application is used by
>>> wicketTester.
>>>
>>> This is my submit button code :
>>>         AjaxButton submitbutton = new AjaxButton("ajaxSubmitLogin") {
>>>
>>>             @Override
>>>             protected void onSubmit(AjaxRequestTarget target, Form<?>
>>>  form)
>>> {
>>>                 Membre modelObject = (Membre) form.getModelObject();
>>>                 Membre membre;
>>>
>>>                 membre = serviceIdentif.identifier(modelObject.getId(),
>>> modelObject.getPassword());
>>>                 if(membre == null)
>>>                     error("Identifiant ou mot de passe incorrect");
>>>                 else
>>>                     setResponsePage(TableauBordPage.class);
>>>             }
>>>
>>>             @Override
>>>             protected void onError(AjaxRequestTarget target, Form<?>
>>>  form) {
>>>                 target.addComponent(feedBackPanel);
>>>             }
>>>         }
>>>
>>> and my test code
>>>         FormTester formTester =
>>> tester.newFormTester(loginForm.getPageRelativePath());
>>>         formTester.setValue("membreId", "benj");
>>>         formTester.setValue("password", "password");
>>>         formTester.submit("ajaxSubmitLogin");
>>>
>>>         tester.assertErrorMessages(new String[] {"Identifiant ou mot de
>>> passe incorrect"});
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
>  Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
> 06.60.78.79.03   E-mail
> : mathilde.pelle...@gmail.com   Mon CV en ligne :
> <http://www.mathilde-pellerin.fr/> http://www.mathilde-pellerin.fr/    Mes
> liens :  <http://www.viadeo.com/fr/profile/mathilde.pellerin>
> <http://fr.linkedin.com/in/mathildepellerin>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to