-1

私はこれを達成する必要があります。ユーザーがボタンをクリックすると、アクションが完了する前にユーザーが再度クリックできないようにする必要があります。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>
4

2 に答える 2

0

DOM Ready でスクリプトをラップしてみてください:

jQuery(document).ready(function(){
    jQuery('#form1').submit(function() {
        jQuery('input[type=submit]', this).prop('disabled', true);
    });
})
于 2013-07-04T01:39:49.757 に答える
-1

これを試して:

jQuery('form1').submit(function(evt) {
    jQuery('input[type=submit]', $(evt.target)).prop('disabled', true);
});
于 2013-07-04T01:37:02.703 に答える