打开一个模式对话框,提交一个包含该表单所有值的表单

时间:2014-03-21 12:40:16

标签: javascript html5 asp.net-mvc-4

我有一个MVC4.0网站,屏幕上有一个按钮。根据我的要求,我点击了那个按钮,提交了一个隐藏的表格,里面有一些隐藏的值。我的要求是

我必须打开一个包含所有这些隐藏值的模型对话框。

请给我一些解决方案。

//under a Beginform of a view this button code is written

<input type="button" id="idBtnScan" name="btnName" value="Scan" onclick="javascript:subProcessURL()" /> 

//I have add this hidden form on click of this button
//@Model.UDConfig.sScanningURL = is the url of the another website's default page
//Model.UDConfig.listScanData (list) that contains all parameter that takes another website.

<form id="idFormSelect" action ="@Model.UDConfig.sScanningURL" method="post" >
<div class="makeHidden">
    @for(int i=0;i<Model.UDConfig.listScanData.Count;i++)
    {
        <input type="text" id="@Model.UDConfig.listScanData[i].sKey" name="@Model.UDConfig.listScanData[i].sKey" value ="@Model.UDConfig.listScanData[i].sValue" />
    }
    <input type="text" id="ASPUserSessionId" name="ASPUserSessionId" value="@Session.SessionID" />
    <input type="submit" name="SubmitDetails" />
</div>
</form>


<script type ="text/javascript" >
function subProcessID() {

    window.showModalDialog("@Model.UDConfig.sScanningURL", "#idFormSelect", "dialogWidth:700px;dialogHeight:500px;scroll:no;")
    $("#idFormSelect").submit();
}

</script>

 $("#idBtnScan")[0].onclick = function () {
        HideDivInfoNErrorMsg();
        ShowOverlay_Base();
        subProcessURL();
        @*$.ajax({
            //type: "POST",
            //url: "@Url.Action("GetSingleScanURL", "CreationOutward")",
            //success: function (data) {
                //window.showModalDialog(data, "", "dialogWidth:700px;dialogHeight:500px;scroll:no;")*@

                //functionality of view image
                $.ajax({
                    type: "POST",
                    url: "@Url.Action("ActionViewImage", "CreationOutward")",
                    success: function (dataImage) {

                        HideDivInfoNErrorMsg();
                        if ((dataImage == "Image not found")
                            || (dataImage == "Image Folder not found")
                            || (dataImage == "Error in processing image")
                            || (dataImage == "Multiple Images found")) {
                            $("#DivInfoNErrorMsg")[0].innerHTML = "<div class=\"errormessage\"><span>".concat(dataImage, "</span></div>");
                            DisplayInfoNErrorMsg();
                        }
                        else {
                            $("#divImgView")[0].innerHTML = dataImage;
                            HideDivInfoNErrorMsg();
                        }

                        HideOverlay_Base();
                    }
                })
                //View Image till here

            //}
        //}
           // )
    }

1 个答案:

答案 0 :(得分:0)

你的按钮调用一个名为'subProcessURL'的javascript函数,但在你的代码中只有一个subProcessID函数。

不匹配