Double submit with AjaxFormSubmitBehavior

2014-10-02 Thread Wayne W
Hi,

I have basically the following:

Form f = new Form('form) {

}


Double submit with AjaxFormSubmitBehavior

2014-10-02 Thread Wayne W
Hi,

I have basically the following

FormString typeInForm = new FormString(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