0
我正在使用功能,如果出現驗證錯誤,那麼goto鏈接將生成一個具有焦點()的頁面頂部所需組件的ID。單擊該鏈接時,所需組件將突出顯示。現在它的工作,如果錯誤是在同一個標籤。但是第一個選項卡是主動對焦功能,不會將指定的文本框指向第三個選項卡。javascript focus()不適用於從prime1中的tab1到tab2
void encodeGotoLabel(FacesContext context, UIComponent component, ResponseWriter writer,
FacesMessage msg) throws IOException {
String id = getid(context, msg);
if (id != null && !FacesMessage.SEVERITY_INFO.equals(msg.getSeverity())
&& !FacesMessage.SEVERITY_FATAL.equals(msg.getSeverity())) {
String inputLabel = findInputLabel(context, id);
if (inputLabel != null) {
ResourceBundle bundle ="bundle";
writer.writeText(" (", null);
writer.writeText(bundle.getString("goTo") + " ", null);
writer.startElement("a", component);
writer.writeAttribute("href", "javascript:document.getElementById('" + id
+ "').focus();",
null);
writer.writeText(inputLabel, null);
writer.endElement("a");
writer.writeText(")", null);
}
}
}
也許元素ID是一樣的,所以你只能得到第一個元素。 – user1087079
問題不清楚,你需要什麼? –
你想切換到哪裏有驗證錯誤的選項卡? –