Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

processing image on form submit

Posted on 2014-01-15
4
Medium Priority
?
434 Views
Last Modified: 2014-01-16
Hello,

I need to show processing image on the page after the submit button is pressed.
I have an image on which i am calling java script function to submit the page.(document.form.submit)

Since there are around 7-8 tables in which the entries are inserted/updated which takes around 15-20 seconds.

Pages X -> document.form.submit -> Page Y.

Q1 -> How to show the processing message since the form is submitted and request is sent to server side.
Q2 -> How the X page comes to know that the processing image should hide?

Please suggest?
0
Comment
Question by:Rocking
  • 2
  • 2
4 Comments
 
LVL 28

Assisted Solution

by:rrz
rrz earned 2000 total points
ID: 39782856
0
 

Author Comment

by:Rocking
ID: 39782930
If the document.from.submit is called then the request goes to the server side and server side processing starts.

I just can't understand then how can the code which is written after the from submit works?
0
 
LVL 28

Accepted Solution

by:
rrz earned 2000 total points
ID: 39783595
>I just can't understand then how can the code which is written after the from submit works?
I am not sure. Let's use some test code. I am testing with the IE11 browser.
<html>
<head>
<title>FormTest</title>
   <style>
       .hidden { display: none; }
       .unhidden { display: block;}
   </style>
<script>
function submitForm(){
    var submitTime	= new Date().getTime();
	document.getElementById("submitTime").innerHTML = "submitted at " + submitTime;
	document.dataForm.submit();
    var submitImage = document.getElementById("submitImage");
    submitImage.className = 'hidden';
    var wait = document.getElementById("waitHTML");
    wait.className = 'unhidden';
	var returnTime	= new Date().getTime();
	document.getElementById("returnTime").innerHTML = "function return at " + returnTime;
}
</script>
</head>
<body>
<form name="dataForm"  method="post" action="result.jsp">
  <input type="text" name="firstName">
  <input type="text" name="lastName">
</form>
<div id="submitImage"> 
    <p><a  onclick="submitForm();">Submit</a></p>
</div>
<div id="waitHTML" class="hidden">
    Please wait until the process is complete.
	<div id="submitTime">   </div>
	<div id="returnTime">   </div>
</div>

</body>
</html>

Open in new window

and result.jsp is
<%@ page import="java.util.Date" %>
<html>
<body>
Request received at<%=new Date().getTime()%><br/>
<%
Thread.sleep(10000);  //mock processing
  out.print("Here is result");
%>
</body>
</html>

Open in new window

0
 

Author Comment

by:Rocking
ID: 39785783
the code is working,thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question