Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Double submit with AjaxFormSubmitBehavior

$
0
0
Hi,

I have basically the following

Form<String> typeInForm = new Form<String>("typeInForm") {
@Override
protected void onSubmit()

doSubmit(this);

};

AjaxFormSubmitBehavior ajax = new AjaxFormSubmitBehavior("onkeyup") {

@Override
protected void onSubmit(AjaxRequestTarget target) {
target.add(resultList);

textField.add(ajax);

When the user just enter something in the the text field the both the form
onSubmit gets called once and the AjaxFormSubmitBehavior onSubmit also
gets called. So far so good. However when the user hits return on the page
the forms onSubmit gets called twice. Looking at the call stack the second
call is coming from the AjaxFormSubmitBehavior.onEvent which intern calls
Form.onFormSubmitted

We need the form onSubmits because if the user hits return the
AjaxFormSubmitBehavior onSubmit never gets called.

How can I stop onSubmit getting called twice? I looked for a
'markformsubmitdone' or something but didn't see anything

many thanks

Viewing all articles
Browse latest Browse all 5648

Trending Articles