js回车键submit
function checkSubmit(e) {
if (e && e.keyCode == 13) {
document.forms["loginform"].submit();
}
}
function fn(e){
if(e.getKeyCode()==13){
var source = e.getSource();
var submitBtn = source.findComponent("loginSubmitButton");
var actionEvent = new AdfActionEvent(submitBtn);
actionEvent.queue();
e.cancel();
}
}
浏览器不缓存表单数据
加在 form表单 <af:clientListener type="mouseOver" method="suppressAutoComplete"/>
function suppressAutoComplete(evt){
var domElement =
AdfRichUIPeer.getDomContentElementForComponent(evt.getSource());
domElement.setAttribute("autocomplete", "off" );
}
页面不要缓存数据
后台加
HttpServletResponse response = (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.addHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
页面加
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
</head>
adf js验证数据
<af:validateRegExp pattern="^[0-9]{1,12}" messageDetailNoMatch="Please enter a valid phone number."/>
<af:validateRegExp pattern="^[0-9a-zA-Z-#]{1,5}" messageDetailNoMatch="Please enter a XXXX number."/>
后台添加script
public void addScript(ActionEvent actionEvent) {
FacesContext facesCtx = FacesContext.getCurrentInstance();
ExtendedRenderKitService rks =
Service.getRenderKitService(facesCtx, ExtendedRenderKitService.class);
rks.addScript(facesCtx, "mycycle()");
}