Skip to content

Instantly share code, notes, and snippets.

@springcome
Created November 5, 2015 00:09
Show Gist options
  • Save springcome/f80255ee40c049bfd200 to your computer and use it in GitHub Desktop.
Save springcome/f80255ee40c049bfd200 to your computer and use it in GitHub Desktop.
SmartGWT Error Icon add remove
// DynamicForm에서 발생한 에러저장공간
Map errors = new HashMap();
// 테스트를 위한 나이
// 나이가 10보다 작으면 오류처리
int age = 10;
// 사용자로부터 입력받는 아이템
TextItem itemAge = new TextItem("age", "Age");
// 유효성 검사
if (itemAge.getValue() != null && Integer.parseInt(itemAge) < age) {
// 오류로 처리
errors.put("age", "나이가 적습니다."); // 오류아이템이름, 오류 텍스트
DynamicForm.setErrors(errors, true);
DynamicForm.showErrors();
} else {
// 오류가 아닐때 처리
errors.remove("age");
DynamicForm.clearFieldErrors("age", true);
}
// 오류아이콘이 표시될 위치
// DynamicForm.setErrorOrientation(FormErrorOrientation.RIGHT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment