I have a problem where the onClick-event is fired twice when a user
presses a button. I'm disabling the button at the top of my onClick-
method. See below:
Code from the presenter:
display.getSaveButton().addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
display.getSaveButton().setEnabled(false);
String name =
(display.getNameInput().getText().trim().equals("Name") ?
"" :
display.getNameInput().getText().trim());
if(name.length() > 0) {
String email =
(display.getEmailInput().getText().trim().equals("Email") ?
"" :
display.getEmailInput().getText().trim());
String cellphone =
(display.getCellphoneInput().getText().trim().equals("Cellphone") ?
"" :
display.getCellphoneInput().getText().trim());
String workphone =
(display.getWorkphoneInput().getText().trim().equals("Work phone") ?
"" :
display.getWorkphoneInput().getText().trim());
String workplace =
(display.getWorkplaceInput().getText().trim().equals("Work place") ?
"" :
display.getWorkplaceInput().getText().trim());
String background =
display.getBackgroundInput().getText().trim();
MyContact contact = new MyContact(name,
email, cellphone,
workphone, workplace, background);
System.out.println("asdasd");
doSaveContact(contact);
} else {
//eventBus.fireEvent(new
DisplayMessage("You must fill in the
name of the contact"));
}
}
});
Code from the view:
Button saveButton = new Button("Save");
table.setWidget(6, 0, saveButton);
Any ideas?
Best regard
Anders
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.