DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
| Code Block |
|---|
final RadioGroup radioGroup = new RadioGroup("radioGroup");
form.add(radioGroup);
final Radio radio1 = new Radio("radio1");
radioGroup.add(radio1);
TextField foo = new TextField("foo") {
public boolean isRequired() {
return Strings.isEqual(radioGroup.getInput(), radio1.getValue());
}
}
form.add(foo);
|
DropDownChoice
Normally, you give a list of domain objects to a DropDownChoice. We can check which one was selected with the getConvertedInput() method as follows:
| Code Block |
|---|
public class DocumentType {
private String name;
private boolean hasExpiryDate;
// getters and setters omitted
}
List<DocumentType> allDocumentTypes = ...;
final DropDownChoice ddc = new DropDownChoice("documentType", allDocumentTypes, new ChoiceRenderer("name"));
form.add(ddc);
TextField expiryDate = new TextField("expiryDate", Date.class) {
public boolean isRequired() {
DocumentType dt = (DocumentType) ddc.getConvertedInput();
return dt != null && dt.getHasExpiryDate();
}
}
form.add(expiryDate);
|