URLボックスとして使用するために、以下のようにカスタマイズされたテキストボックスを作成しました
private class URLBox extends Textbox {
// String value =null;
URLBox(String infoValue) {
if (!Utility.isBlank(infoValue)) {
setValue(infoValue);
} else {
setValue("Enter URL");
}
}
@SuppressWarnings("unchecked")
public void initialize() {
addEventListener("onClick", new EventListener() {
public void onEvent(Event event) throws Exception {
Textbox tb = (Textbox) event.getTarget();
if (tb.getValue().equalsIgnoreCase("Enter URL")) {
tb.setValue("");
}
}
});
addEventListener("onBlur", new EventListener() {
public void onEvent(Event event) throws Exception {
final URLBox tb = (URLBox) event.getTarget();
if (Utility.isBlank(tb.getValue())) {
tb.setValue("Enter URL");
} else if (!PeopleInfoViewModel.IsMatch(tb.getValue())) {
Messagebox.show("Please Enter a valid URL");
}
}
});
}
}
同様に、ナンバーボックスに対して行ったことがあります。私の問題は、URL ボックスに無効な URL を入力してナンバーボックスをクリックすると、ナンバーボックスの検証も開始されることです。URLボックスの要件を満たすまで、ナンバーボックスの検証を開始しないでください。これを達成するにはどうすればよいですか。ありがとう。