Hi all,
To handle the case where somebody hits enter in a form field which has
an (Ajax)Button to submit the entire form by ajax, we used an
AjaxFormSubmitBehavior attached to the form's onsubmit in wicket 1.4.x
After upgrading to 1.5 our ajax indicator was not hidden after the ajax
request, wich asked for some investigating.
It turns out, this is what happens:
- onsubmit is called by browser and calls wicketSubmitFormById()
- that method calls Wicket.Ajax.Call.SubmitForm() which in turn calls
onsubmit again
The issue with the ajax indicator image remaining visible is simply due
to showIncrementally being called twice, and hideIncrementally only once.
But let's ignore that for now, the bigger issue is how do we properly
handle this use case? We chose a form onsubmit handler to prevent adding
an onKeyUp handler (and checking for enter key) to all form fields, as
this seems more elegant.
Having the form's onsubmit delegate to the ajaxbutton will create the
exact same problem: a loop.
How do others solve this in 1.5?