DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
| Code Block |
|---|
final TextField nameA = new TextField("name", ...);
final TextField descriptionA = new TextField("descriptionA", ...);
final TextField nameB = new TextField("nameB", ...);
final TextField descriptionB = new TextField("descriptionB", ...);
// the validators can be anything, but for simplicity we just use required
nameA.setRequired(true);
descriptionA.setRequired(true);
nameB.setRequired(true);
descriptionB.setRequired(true);
final Button buttonA = new Button(id) {
public boolean onSubmit() {
// because we overrode the form processing we need to handle validation/processing on the components ourselves
nameA.validate();
descriptionA.validate();
if(!nameA.isValid() || !descriptionA.isValid()){
// didn't validate so we stop processing (validation errors will be displayed provided we are using a FeedbackPanel or similar)
return;
}
// TODO : now we have the updated values/models so we can perform whatever button A is supposed to do
}
});
// set the form processing to false so that no validation/processing will occur on the form when button A is clicked
buttonA.setDefaultFormProcessing(false);
// we can do the same thing for B components
final Button buttonB = new Button(id) {
public boolean onSubmit() {
// because we overrode the form processing we need to handle validation/processing on the components ourselves
nameB.validate();
descriptionB.validate();
if(!nameB.isValid() || !descriptionB.isValid()){
// didn't validate so we stop processing (validation errors will be displayed provided we are using a FeedbackPanel or similar)
return;
}
// TODO : now we have the updated values/models so we can perform whatever button B is supposed to do
}
});
// set the form processing to false so that no validation/processing will occur on the form when button B is clicked
buttonB.setDefaultFormProcessing(false);
final Button buttonC = new Button(id) {
public boolean onSubmit() {
// TODO : all validation passed because form processing is true so we can perform whatever button C is supposed to do
}
});
|
...