I'm a bit late in responding so I don't know if this is still useful to
you, but here is how we solved your requirement in our project. I'd still
like to find a more elegant approach, but it is the least intrusive
approach I could come up with and it sure beats the bazooka one. (which
could really spiral out of control depending on the complexity of your
application)

Step 1: create a marker interface
public interface ISkipRequiredCheck { }

Step 2: mark the buttons that need to skip the required checks
private class SaveButton extends Button implements ISkipRequiredCheck {
// Your button code
}

Step 3: do not set the fields required, but override isRequired
@Override
public boolean isRequired() {
return !this.getForm().findSubmittingButton() instanceof ISkipRequiredCheck;
}

Reply via email to