繁体   English   中英

dojo弹出窗口自动关闭

[英]dojo popup is closing automatically

我有一个包含以下内容的JSP文件

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="tag" tagdir="/WEB-INF/tags"%>

<portlet:defineObjects />


<portlet:actionURL var="action" />

<script>
dojo.require("dojo.parser");
dojo.require("dijit.TitlePane");  
dojo.require("dijit.Dialog");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.Tree");
dojo.require("dijit.form.DateTextBox");
dojo.require("dijit.Tooltip");

dojo.require("dijit.form.ValidationTextBox");
dojo.require("dijit.form.Form");
dojo.require("dojox.validate");
dojo.require("dojox.validate.web");
dojo.require("dojox.validate.us");
dojo.require("dijit.form.DropDownButton");
dojo.require("dijit.TooltipDialog");
</script>

<form:form name="SubmitForm" action="${action}"> 

<input style="display:block;" id="btnUploadConfirm" class="actionBtn" type="submit" value="Upload" style="float: right;" name="" onclick="dijit.byId('dialogUpload').show();"  /> 

<div dojoType="dijit.Tooltip" connectId="b2" position="above"> Upload </div>



</form:form>

 <div id="dialogUpload" class="confirmationPopupSE popupWidth" dojoType="dijit.Dialog" title="Upload Document" >
 <form method="post" action="<portlet:actionURL/>" enctype="multipart/form-data" onSubmit="return validate();"> 
 <input type="file" name="file" id="uploadFile" /> <br />
 <div id="errorUpload" class="errorMsg"></div>

 <br />
 <div class="">
 <input id="btnUploadConfirm" class="tableButton" type="submit" value="Upload" name="" onclick="setAction2('upload');" />
 <input id="btnUploadCancel" class="tableButton" type="button" value="Cancel"
  onclick="document.getElementById('errorUpload').innerHTML = '';document.getElementById('errorUpload').style.display='none';dijit.byId('dialogUpload').hide();" />
 </div>
 </form>
</div>

如果我使用上述jsp文件运行,然后单击上载按钮,则会弹出该窗口,但会立即关闭。

但是,如果我在没有外部form:form标记的情况下运行上述代码,则弹出窗口会按预期正常工作,并且不会自行关闭..这是什么问题?

尝试停止click事件的传播:

 <input id="btnUploadConfirm" [snip] onclick="setAction2('upload');return false;" />

或者也许只是从btnUploadConfirm中删除type="submit"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM