Hi,
  i have this problem when I submit the form using formpanel. The
onSubmit event which is fired before submission of the form for doing
validation did the validation for two times. Is there any way to
handle this?

  Here is the code:

                 fpLoginPanel.setAction("http://192.168.1.3/rajakumar/
logindemo/loginphp.php");
                fpLoginPanel.setMethod(FormPanel.METHOD_POST);
                fpLoginPanel.setEncoding(FormPanel.ENCODING_URLENCODED);

                tbUsername.getElement().setId("tbUsername");
                tbPassword.getElement().setId("tbPassword");
                tbUsername.setName("tbUsername");
                tbPassword.setName("tbPassword");

                lblUserName.getElement().setId("lblUserName");
                lblUserName.setText("User Name :");
                lblPassword.getElement().setId("lblPassword");
                lblPassword.setText("Password :");

                butLogin.getElement().setId("butLogin");
                butLogin.getElement().setPropertyString("name", "submit");
                butLogin.setText("Submit");

                butLogin.addClickHandler(new ClickHandler(){
                        public void onClick(ClickEvent click){
                                Window.alert("In submit");
                                fpLoginPanel.submit();
                        }
                });

                
ftFormElementContainer.getElement().setId("ftFormElementContainer");
                Window.alert("tbUsername.getName()"+tbUsername.getName());


                ftFormElementContainer.setWidget(0, 0, lblUserName);
                ftFormElementContainer.setWidget(0, 1, tbUsername);
                ftFormElementContainer.setWidget(1, 0, lblPassword);
                ftFormElementContainer.setWidget(1, 1, tbPassword);


                
ftFormElementContainer.getCellFormatter().setHorizontalAlignment(2,
0, HasHorizontalAlignment.ALIGN_CENTER);
                ftFormElementContainer.setWidget(2, 0, butLogin);
                ftFormElementContainer.getFlexCellFormatter().setColSpan(2, 0, 
2);


                fpLoginPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
                      public void onSubmit(SubmitEvent event) {
                        // This event is fired just before the form is 
submitted. We
can take
                        // this opportunity to perform validation.
                          Window.alert("Before the submission of the form");
                        }
                      });


                fpLoginPanel.addSubmitCompleteHandler(new
FormPanel.SubmitCompleteHandler() {
                      public void onSubmitComplete(SubmitCompleteEvent event) {
                        Window.alert(event.getResults());

                      }
                    });

                fpLoginPanel.setWidget(ftFormElementContainer);
                RootPanel.get("nameFieldContainer").add(fpLoginPanel);


        }

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to