radioGroupItem.setTitle("Will you be attending the meeting on April 4th? If no, please provide a reason");
TextItem textItem = new TextItem();
textItem.setName("reason");
textItem.setTitle("Reason");
RequiredIfValidator ifValidator = new RequiredIfValidator();
ifValidator.setExpression(new RequiredIfFunction() {
public boolean execute(FormItem formItem, Object value) {
String valueStr = (String) radioGroupItem.getValue();
return "No".equals(valueStr);
}
});
ifValidator.setErrorMessage("Please provide a reason");
textItem.setValidators(ifValidator);
ButtonItem buttonItem = new ButtonItem("validate", "Validate");
buttonItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {