Solved

processing image on form submit

Posted on 2014-01-15
4
422 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 27

Assisted Solution

by:rrz
rrz earned 500 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 27

Accepted Solution

by:
rrz earned 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

626 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