我需要实现这一点。当用户点击一个按钮时,我们需要防止用户在动作完成之前再次点击。它在Firefox中工作。但不是在 IE 和 Chrome 中。我需要在 IE 和 Chrome 中设置什么设置吗?我正在使用primefaces 3.5。
我也试过 .attr 。Firefox 可以正常工作,但 IE 和 Chrome 不能正常工作。
xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:hx="http://www.ibm.com/jsf/html_extended">
<h:head>
<title>Enterprise</title>
<meta http-equiv="keywords" content="enter,your,keywords,here" />
<meta http-equiv="description"
content="A short description of this page." />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet"
href="#{request.contextPath}/theme/primefaces-aristo/themeMain.css" />
<link rel="SHORTCUT ICON" href="../../theme/csl.ico" id="ma1001" />
<script src="../../scripting.js"></script>
<script type="text/javascript">
jQuery('form1').submit(function() {
jQuery('input[type=submit]', this).prop('disabled', true);
});
</script>
<f:view locale="#{pc_Ma1001.userLocale}" />
<f:loadBundle basename="messages.MessageResources" var="msg" />
</h:head>
<f:metadata>
<f:event listener="#{pc_Ma1001.onPageLoadBegin}" type="preRenderView"></f:event>
</f:metadata>
<h:body>
<h:form id="form1" enctype="multipart/form-data" prependId="false">
<ui:include src="../../theme/menubar.xhtml" />
<td><p:commandButton type="submit" value="Create"
styleClass="commandButton" id="maintenance_command_add"
action="#{pc_Ma1001.doMa1001_command_addAction}" ajax="false"></p:commandButton>
</td>
</h:form>
</h:body>
</html>