문제

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