admin管理员组文章数量:1290938
I have one form in JSP. I have some input fields in that page, when user types his values then he clicks submit so that values will be inserted into the database.
But my purpose is that when user clicks submit button then one new popup window will be generated and this new popup window will carry those values at the time of inserted values in parent window. Ex: first page: Insert.jsp and popup window: Verifyinsert.jsp. In Insert.jsp page 3 input fields are present such as roll number, student name, address. User will enter these 3 fields first on Insert.jsp page and then user will click submit on Insert.jsp page, then one new popup window(Verifyinsert.jsp) will be generated carrying values when user just has typed in Insert.jsp and in that Verifyinsert.jsp page, submit button is present and if user clicks submit then records will be inserted into database and if cancel button will be clicked on Verifyinsert.jsp then that popup window will be simply disappeared. How to do it?
Any help is much appreciated.
I have one form in JSP. I have some input fields in that page, when user types his values then he clicks submit so that values will be inserted into the database.
But my purpose is that when user clicks submit button then one new popup window will be generated and this new popup window will carry those values at the time of inserted values in parent window. Ex: first page: Insert.jsp and popup window: Verifyinsert.jsp. In Insert.jsp page 3 input fields are present such as roll number, student name, address. User will enter these 3 fields first on Insert.jsp page and then user will click submit on Insert.jsp page, then one new popup window(Verifyinsert.jsp) will be generated carrying values when user just has typed in Insert.jsp and in that Verifyinsert.jsp page, submit button is present and if user clicks submit then records will be inserted into database and if cancel button will be clicked on Verifyinsert.jsp then that popup window will be simply disappeared. How to do it?
Any help is much appreciated.
Share Improve this question edited Jan 31, 2012 at 8:08 Teun Zengerink 4,3935 gold badges32 silver badges32 bronze badges asked Jan 24, 2012 at 12:17 TomTom 7717 gold badges22 silver badges42 bronze badges 1- only enclose the call to the jsp into the window.open sentence saludos – elopez Commented Jan 27, 2012 at 18:14
3 Answers
Reset to default 2Use onSubmit event
<html>
<head>
<script type="text/javascript">
function greeting(){
alert("Wele " + document.forms["frm1"]["fname"].value + "!")
}
</script>
</head>
<body>
What is your name?<br />
<form name="frm1" action="submit.htm" onsubmit="greeting()">
<input type="text" name="fname" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Are you asking how to show popup window? Should it be js popup, with no page reload, or separate browser tab? For former we use jqModal library, examples. When user clicks on Submit button you need to display that popoup. When user clicks on Send button on that popup you need to get all values and send them to the server. There are a couple of way to do that too :)
Open a popup window in the submit of your Insert.jsp using
window.open("../insert.jsp?param1=xx&&pram2=cc")
you can send the parameters as append to the url of new window like above.
In the submit of Verifyinsert.jsp , you can call a parent page java script usign
window.opener.saveValue()
which is a javscript function in your parent page to save values to database . Close your popup after saving .
本文标签: javascriptOpen a popup window on submit buttonStack Overflow
版权声明:本文标题:javascript - Open a popup window on submit button - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741523711a2383343.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论