質問

I have a form panel (myForm) with a submit button added onto a simple panel. Every time the submit is pressed myForm.addSubmitCompleteHandler is called twice

      mySubmit.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {         
                myForm.submit();
        }});
         ...
         myForm.addSubmitCompleteHandler(new SubmitCompleteHandler() {
            @Override
            public void onSubmitComplete(SubmitCompleteEvent event) {
                // what ever's here happens twice
            }
        }); 

I've double checked my code and ordering and placing of widgets and panels. What could possibly be causing this?

What I am trying to achieve is an alert that submission is complete.

役に立ちましたか?

解決

It seems like adding the line

event.preventDefault() 

in the addClickHandler of the submit button helps. Also make sure you don't have duplicate setAction Calls for the form

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top